Linux Terminal Tab Completion


About:

Tab completion is a feature in the Linux terminal that allows you to quickly complete file and directory names, command names, and other items by pressing the “Tab” key.


Steps of Config:

Tab completion can be customized and extended by modifying the .inputrc file

Create an “.inputrc” file in the user’s home directory.

touch .inputrc

Case-sensitive auto-completion

vim .inputrc

Enter set completion-ignore-case on

:wq save and exit

Display all possible choices

vim .inputrc

Enter set show-all-if-ambiguous on

:wq save and exit


Using the Alternative Config

In fact, this command can be used to do it all.

cat >> ".inputrc" << EOF
set completion-ignore-case on
set show-all-if-ambiguous on
EOF

Close the terminal and reopen the terminal.


Conclusion:

Tab completion can also be used with options and arguments of commands. For example, you can type “ls -” and then press “Tab” to see a list of available options for the “ls” command.