How To Add Bash Auto Completion In FreeBSD?

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.

Using pkg

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 –

Conclusion

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.

Previous FreeBSD: Install And Use Bash Shell
Next [ubuntu] iMac and wake from sleep radeon issues
 

About author

You might also like

Linux Topics 0 Comments

How To List The All Enabled Repositories In Linux?

This post was last updated on August 1st, 2020 at 01:28 pmA software repository is a database of software packages stored on a remote server. Generally, these packages are retrieved

How To 0 Comments

How To Install Ubuntu 20.04 LTS?

This post was last updated on August 1st, 2020 at 12:51 pmUbuntu is among the most popular Linux distributions. It is easy to use, easy to install, and includes everything

How To 0 Comments

Expect Scripts

This post was last updated on July 9th, 2020 at 04:55 pmHow to send escape characters through Expect http://mini.net/tcl/3038 How to send escape characters through Expect http://mini.net/tcl/201 Expect Send Function

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply