What tool do I need to install to make my terminal show the autocompletion of the command that I'm writing?
Kali uses zsh instead of bash
as the default shell and the feature you are referring to is called autosuggestions.
Before you begin, you will need to set up zsh
if you haven't already.
Run the following to install zsh
and follow the instructions when prompted (it's best to accept the defaults and auto-generate your zshrc
file):
sudo add-apt-repository universe
sudo apt update
sudo apt install zsh zsh-syntax-highlighting
zsh
For 20.04, run the following command to install the zsh-autosuggestions
package:
sudo apt update
sudo apt install zsh-autosuggestions
For Ubuntu 18.04, you can run the following commands to install the zsh-autosuggestions repository Keep in mind that the owner of the key may distribute updates, packages and repositories that your system will trust (more information):
echo 'deb http://download.opensuse.org/repositories/shells:/zsh-users:/zsh-autosuggestions/xUbuntu_18.04/ /' | sudo tee /etc/apt/sources.list.d/shells:zsh-users:zsh-autosuggestions.list
curl -fsSL https://download.opensuse.org/repositories/shells:zsh-users:zsh-autosuggestions/xUbuntu_18.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/shells_zsh-users_zsh-autosuggestions.gpg > /dev/null
sudo apt update
sudo apt install zsh-autosuggestions
Finally, run the following commands to add autosuggestions to your zshrc
file:
cp ~/.zshrc ~/.zshrcbackup
echo "source $(dpkg -L zsh-autosuggestions | grep 'zsh$')" | tee -a ~/.zshrc
echo "source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" | tee -a ~/.zshrc
and don't forget to source your ~/.zshrc
file to apply the changes (if you are in bash or another shell, run the zsh
command first):
source ~/.zshrc
See here if you want to make zsh the default shell.
Run the following command to search for other plugins, plugin managers, related packages (like fuzzyfinder), and other compatible shells:
apt-cache search zsh
Related videos on Youtube
![raylight](https://lh5.googleusercontent.com/-d4GtE-t3ZqU/AAAAAAAAAAI/AAAAAAAAAAA/AMZuucm5QA8U51D5o-Z300lwdwrAog6leA/s96-c/photo.jpg?sz=256)
raylight
Updated on September 18, 2022Comments
-
raylight almost 2 years
I use Ubuntu on a daily basis, recently I've seen that the terminal on Kali Linux behaves differently from the terminal on Ubuntu... I can see the end of the command that I'm typing based on the history of commands that I've typed like the following:
I know I can use autocompletion by pressing tab, but this feature is something else since I can see the command before pressing tab... That's not a Kali related question too since I just want to replicate this feature on Ubuntu 20.04. Is it a feature that I can easily install on Ubuntu by installing some tool with
apt install
? Or is it a configuration that I need to do? -
mchid over 3 yearsand yes, this works in gnome terminal. Gnome terminal uses
bash
by default but to usezsh
in gnome-terminal just run the commandzsh
. To go back to bash, typeexit
orbash
. -
mchid over 3 yearsTo make gnome-terminal always use
zsh
follow the instructions for how to makezsh
the default shell. -
raylight over 3 yearsThanks! That's what I wanted... It seems I can't vote up to your answer because I still don't have 15 of reputation though :)
-
rexkogitans over 3 years@mchid going back to bash with
bash
is not really going back, but going forward to a new bash session while leaving everything before (bash, zsh) running. -
Thomas Brooman over 3 yearsHighly recommended addition to ZSH : ohmyz.sh