When at the Linux or Unix shell typing in long file names or directories can become a burden, and to eliminate this there is a very handy feature called “Command-Line completion”. Command-line completion (also tab completion/auto completion) is a common feature of command line interpreters, in which the program automatically fills in partially typed commands. For example, if there is a file named “auto-complete.txt”, and we want to read it, I can type “cat auto” followed by tab, and it will auto-complete the file name as shown in the gif image below. But unfortunately while using YUM tool, i couldn’t find this feature. So we shall see how auto-completion can be enabled for YUM tool and the usage of it.
1. Login as root and Install Bash-completion package using YUM
Tue Nov 05>$Su - Tue Nov 05>#yum install bash-completion Loaded plugins: security Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package bash-completion.noarch 0:20060301-1.el5.rf set to be updated --> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================
Package Arch Version Repository Size
===========================================================================================
Installing:
bash-completion noarch 20060301-1.el5.rf rpmforge 129 k
Transaction Summary
===========================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Total download size: 129 k
Is this ok [y/N]: y
Downloading Packages:
bash-completion-20060301-1.el5.rf.noarch.rpm | 129 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : bash-completion 1/1
Installed:
bash-completion.noarch 0:20060301-1.el5.rf
Complete!
Tue Nov 05>$
2. Exit Shell and Login again – Very Important
Tue Nov 05>#exit
3. How to use auto-completion in YUM
Where ever you see [TAB] then it means you have to press tab button on the keyboard.
Tue Nov 05>$yum in[TAB] info install Tue Nov 05>$yum ins[TAB] Tue Nov 05>$yum install
4. How to use auto-completion for package names in YUM
Tue Nov 05>$yum install fire[TAB] firefox.i386 firefox.x86_64 firewalk.x86_64 Tue Nov 05>$yum install firew[TAB] Tue Nov 05>$yum install firewalk.x86_64
You may also find useful : How to configure yum to use CentOS repository in RHEL machine