How to Enable Syntax Highlighting and Autosuggestions in Bash (No sudo Required)
If you're stuck with Bash on a shared Linux system and don't have root access, you might think you're out of luck when it comes to quality-of-life features like syntax highlighting and fish-style autosuggestions. You're not. This guide walks through how to set up both using ble.sh entirely in your home directory.
What You'll Get
- Syntax highlighting as you type commands
- Grey ghost-text autosuggestions pulled from your history, accepted with the
→right arrow key - No sudo required at any step
Step 1: Check if gawk is Available
ble.sh requires GNU Awk (gawk) to build. Check what's on your system:
which awk mawk gawk nawk
awk --version
If awk --version shows GNU Awk, you're good. If it shows something else (like mawk), you'll need to install gawk manually — see the next step.
Step 2: Install gawk Without sudo (if needed)
If gawk isn't available, build it from source into your home directory:
Notes: You may want to change to the latest version of gawk in the following command.
wget https://ftp.gnu.org/gnu/gawk/gawk-5.3.0.tar.gz
tar -xf gawk-5.3.0.tar.gz
cd gawk-5.3.0
./configure --prefix=$HOME/.local
make && make install
Then make sure ~/.local/bin is on your PATH:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
Verify it worked:
gawk --version # should show GNU Awk
Step 3: Install ble.sh
Clone and build ble.sh into your home directory:
cd ~
git clone --recursive https://github.com/akinomyoga/ble.sh.git
make -C ble.sh install PREFIX=~/.local
Step 4: Enable It in ~/.bashrc
Add the following lines to your ~/.bashrc:
echo 'source ~/.local/share/blesh/ble.sh' >> ~/.bashrc
echo 'bleopt complete_auto_history=1' >> ~/.bashrc
echo 'bleopt complete_auto_complete=1' >> ~/.bashrc
Then reload your shell:
source ~/.bashrc
All Done
From now on, every Bash session will have:
- Commands highlighted in colour as you type
- Autosuggestions shown in grey based on your command history
- Press
→to accept a suggestion, or just keep typing to ignore it
Troubleshooting
gawk could not be found during make — You have mawk or another awk variant. Follow Step 2 to build gawk from source.
Suggestions not appearing — Make sure both bleopt lines are present in ~/.bashrc and that you've reloaded it with source ~/.bashrc.
Want an easier life? — Check if zsh is already installed on your system:
which zsh
If it returns a path, you can switch to it with no sudo required:
chsh -s $(which zsh)
Zsh has a much richer plugin ecosystem (zsh-autosuggestions, zsh-syntax-highlighting) and these features work out of the box with Oh My Zsh.