How to get an autocompletion in terminal Zorin bash shell [SOLVED]

Adithyansm

Active Member
Joined
Nov 11, 2021
Messages
226
Reaction score
99
Credits
1,625
I have been using and learning kali for a couple of months and am used to its terminal. Like it will show a preview of previously typed command and we can use arrow keys to type the whole command

2021-12-27_20-33.png


and now I am using Zorin (Xfce) bash shell and missing that feature very much. Is there any way to get this in Zorin shell? kali was running zsh shell.
Please help if anyone knows the solution.
 
Last edited:


sudo apt install zsh

You can then configure it to run the framework over bash shell.
 
There are a couple of ways - first the Tab key not working for Auto-complete
make sure bash completion is installed
Code:
sudo apt install bash-completion
  1. Open Application Menu > Settings > Window Manager.
  2. Click on 'Keyboard' tab.
  3. Clear the 'Switch window for same application' setting.
win.png

This is due to a bug in Xfce sending a super key modifier with the command
If the above does not fix it then proceed below
--------------------------------------------------------------------------------------

Step 2 -Enable bash-completion in your .bashrc file
make sure bash completion is installed
Code:
sudo apt install bash-completion
I believe Zorin uses gedit as it's text editor but if it is different just substitute where it says gedit with the text editor you are using

Open your gedit ~/.bashrc and if these content doesn't exist there, add them at the end of it and save it.
Code:
sudo gedit ~/.bashrc

# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi


Important: After changing the file you need to source your ~/.bashrc with
Code:
source ~/.bashrc
close and reopen your Terminal. It should be fixed now.
 
There are a couple of ways - first the Tab key not working for Auto-complete
make sure bash completion is installed
Code:
sudo apt install bash-completion
  1. Open Application Menu > Settings > Window Manager.
  2. Click on 'Keyboard' tab.
  3. Clear the 'Switch window for same application' setting.
View attachment 11289
This is due to a bug in Xfce sending a super key modifier with the command
If the above does not fix it then proceed below
--------------------------------------------------------------------------------------

Step 2 -Enable bash-completion in your .bashrc file
make sure bash completion is installed
Code:
sudo apt install bash-completion
I believe Zorin uses gedit as it's text editor but if it is different just substitute where it says gedit with the text editor you are using

Open your gedit ~/.bashrc and if these content doesn't exist there, add them at the end of it and save it.
Code:
sudo gedit ~/.bashrc

# enable bash completion in interactive shells
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi


Important: After changing the file you need to source your ~/.bashrc with
Code:
source ~/.bashrc
close and reopen your Terminal. It should be fixed now.
It didn't worked any other solutions
 
If you want to use zsh, you’ll need to install zsh and then set zsh as the default shell for your user account, instead of bash.

It’s been a while since I’ve used zsh. I usually stick with bash. However, the process should be:
1. Install zsh
Bash:
sudo apt install zsh
I haven’t installed or used zsh for a long time, so I’m not sure whether the installer will ask if you want to make zsh your default shell or not.
If it doesn’t, the next thing to do is:
2. Set zsh as your default shell
Bash:
chsh -s "$(which zsh)"

Then close your terminal, open up a new terminal and you should be using zsh.
Or if that doesn’t work - log out and log back in again, or reboot and log back in and once you’re logged in, open a terminal and you should be using zsh as your default shell!
 
If you want to use zsh, you’ll need to install zsh and then set zsh as the default shell for your user account, instead of bash.

It’s been a while since I’ve used zsh. I usually stick with bash. However, the process should be:
1. Install zsh
Bash:
sudo apt install zsh
I haven’t installed or used zsh for a long time, so I’m not sure whether the installer will ask if you want to make zsh your default shell or not.
If it doesn’t, the next thing to do is:
2. Set zsh as your default shell
Bash:
chsh -s "$(which zsh)"

Then close your terminal, open up a new terminal and you should be using zsh.
Or if that doesn’t work - log out and log back in again, or reboot and log back in and once you’re logged in, open a terminal and you should be using zsh as your default shell!
But I don't want to use Zsh. I want this feature working in bash shell do you know how to get this working.
 
I have managed to get this feature and configure zsh shell by following this guide: https://www.tecmint.com/install-oh-my-zsh-in-ubuntu/

But now how to show the full path of the current directory in the zsh shell like the bash shell.
2021-12-28_20-16.png
: this is the bash shell
2021-12-28_20-16_1.png
: this is the zsh shell, this only shows the current folder name instead of the directory how to show the full path to the current directory
 
I have managed to get this feature and configure zsh shell by following this guide: https://www.tecmint.com/install-oh-my-zsh-in-ubuntu/

But now how to show the full path of the current directory in the zsh shell like the bash shell.
View attachment 11294: this is the bash shell
View attachment 11295: this is the zsh shell, this only shows the current folder name instead of the directory how to show the full path to the current directory
oh my posh is better in my opinion https://ohmyposh.dev/docs/linux
 
It didn't worked any other solutions
The other option is use a different terminal - that should have worked - it worked on my Xfce Terminal - what Terminal are you using?

You can add /etc/profile.d/bash_completion.sh to your ~/.bashrc file as follows:

## source it from ~/.bashrc or ~/.bash_profile ##
echo "source /etc/profile.d/bash_completion.sh" >> ~/.bashrc
## Another example Check and load it from ~/.bashrc or ~/.bash_profile ##
grep -wq '^source /etc/profile.d/bash_completion.sh' ~/.bashrc || echo 'source /etc/profile.d/bash_completion.sh'>>~/.bashrc
 
Last edited by a moderator:
The other option is use a different terminal - that should have worked - it worked on my Xfce Terminal - what Terminal are you using?
I have managed it to get work in zsh shell
 
The other option is use a different terminal - that should have worked - it worked on my Xfce Terminal - what Terminal are you using?
I have managed to get this feature and configure zsh shell by following this guide: https://www.tecmint.com/install-oh-my-zsh-in-ubuntu/

But now how to show the full path of the current directory in the zsh shell like the bash shell.
View attachment 11294: this is the bash shell
View attachment 11295: this is the zsh shell, this only shows the current folder name instead of the directory how to show the full path to the current directory
Can you tell me how to get this working! It would be a great help
 
Ok. So what you’re saying is - you want to make bash look and behave like zsh?

In which case, why not just use zsh?!

Offhand, I have no idea whether this is possible to do in bash or not!
Bash should already have auto-completion, but it’s not going to look like zsh.
The only other thing you could try is modifying your prompt to show different information.
See here:
I don’t know if that’s going to get you any closer, or not!
 
If I remember correctly with bash you have to use tab for auto-completion and with zsh auto-completion it automatically displays something without you having to type anything based on your history and the command your are typing and then you can use tab to accept it or continue typing for more options.
 
If I remember correctly with bash you have to use tab for auto-completion and with zsh auto-completion it automatically displays something without you having to type anything based on your history and the command your are typing and then you can use tab to accept it or continue typing for more options.
Yep either tab or the arrow keys for bash
 
I have choose to use zsh insted of bash, but now I want to display the whole path of the current directory instead of just the name of the folder in zsh do anyone know how to do that .
 

Members online


Latest posts

Top