How To Add Bash Auto Completion In FreeBSD?
This post was last updated on August 1st, 2020 at 09:06 am
Bash is a modern and one of the most widely used shells in Unix like operating systems. It is the sh compatible shell that can run sh scripts without any modifications.
Bash auto-completion or tab completion is a feature in which user types a few words and shell suggests the whole command you can press the tab key to accept the suggestion. This feature is common in modern shells.
I already discussed how to install and use bash in FreeBSD. This article is about enabling the bash auto-completion feature in FreeBSD.
How to install the bash-completion package
In FreeBSD, you need to install the bash-completion package in order to enable the bash auto-completion feature. There are two ways to install software packages in FreeBSD: pkg and ports collection. The pkg is used to install from prebuilt binaries while ports collection is used to install packages from sources. You can use either way to install the bash-completion feature in your system.
Please note that you need to be a root user or have superuser privilege for installing packages in FreeBSD.
Use the following command to install it using pkg –
# pkg install bash-completion
Using ports collection
First, change the current working directory to port bash-completion by using –
# cd /usr/ports/shells/bash-completion
and then run –
# make install clean
Find and execute bash_completion.sh
Now you have installed the bash-completion package in your system to enable the command auto-completion feature. To enable this feature first you need to find bash_completion.sh file in your system. Use the following command to locate this file –
# locate bash_completion
Now execute this file by using the following command to enable the bash_completion feature in your system.
# source /usr/local/share/bash-completion/bash_completion.sh
Alternatively, you can logout from the current working shell.
Check the bash auto-completion feature
This feature should now work on your system. You can try it by entering the partial command or path and press tab to display the suggestions. As you can see in the image below –
Tab completion feature works for commands as well as paths and it is programmable. Ok, that’s all for now if you have something to say on this topic then write us in the comments below.
You might also like
This post was last updated on August 1st, 2020 at 10:28 amThe sudo (superuser do) is a program for Unix like operating systems. It allows a user to run a
This post was last updated on August 3rd, 2020 at 02:34 pmThere are many users who use a dual boot computer. Dual-booting Linux with Windows operating system has various advantages
This post was last updated on August 1st, 2020 at 12:38 pmLinux or Unix provides cat command that can be used to create, view, and concatenate files. It reads the