The Centos 6.6 command line implementation cannot implement automatic completion.
The ubuntu system used by colleagues in the company has good auto-completion functions. However, when my Centos 6.6 system uses sudo, it cannot be automatically completed, and the git command cannot be automatically completed.
The solution for searching on the internet is as follows.
1. git cannot complete the problem
Download git source code
[Python] view plaincopy
- $ Gitclonehttps: // www.kernel.org/pub/scm/git/
Find the git-completion.bash file copy ~ /Directory
$ sudo cp contrib/completion/git-completion.bash ~/.git-completion.bash
Edit the/etc/bashrc file and add: source/home/yourname/. git-completion.bash
Or
$ sudo cp contrib/completion/git-completion.bash /etc/bash_completion.d/
source /etc/bash_completion.d/git-completion.bash
Another way to get the git-completion.bash:
[Python] view plaincopy
- Sudofind/-name 'git-completion *'
- /Usr/share/doc/git-1.7.1/contrib/completion/git-completion.bash
Therefore, there is a file in the linux system, and you can copy it directly.
Second, Automatic completion. Here, the completion is not only the system's default completion path and file name completion function, but also the completion of command parameters. With this completion, in Bash, almost all the completions that can be completed.
The RedHat system is not installed by default. You need to install bash-completion. When you run sudo yum install xxx, you can complete any of these words, input them to yum ins, press the Tab key, and then press the Tab to complete the install.
Before installation, execute ls in the/etc/bash_completion.d/directory:
[Python] view plaincopy
- Gitrpmlint
- Createrepo. bashgvfs-bash-completion.shscl.bash
- Dbus-bash-completion.shperfsubversion
- Dkmspk-completion.bashyum.bash
- Gdbus-bash-completion.shrpmdevtools.bash-completionyum-utils.bash
Install: [python] view plaincopy
- Sudoyuminstallbash-completion
View the files under/etc/bash_completion.d:
[Python] view plaincopy
- Antgvfs-bash-completion.shrcs
- Autoconfgzipredefine_filedir
- Automakeiconvrfkill
- Bash-builtinsifupdownrpcdebug
- Bind-utilsinforpm
- Brctliproute2rpmdevtools. bash-completion
- Bumblebeeiptablesrpmlint
- Bzip2javarsync
- Chkconfiglsofsamba
- Configurelvmscl. bash
- Coreutilslzmaservice
- Cpan2distmakesh
- Cpiomanshadow
- Createrepo. bashmdadmsmartctl
- Crontabminicomsqlite3
- Cryptsetupmodule-init-toolsssh
- Cupsmysqladminstrace
- Cvsnet-toolssubversion
- Dbus-bash-completion.shnmaptar
- Ddntpdatetcpdump
- Dhclientopen-iscsiutil-linux
- Dkmsopensslwireless-tools
- Dvd + rw-toolsperfwodim
- E2fsprogsperlwvdial
- Findutilspk-completion.bashxmllint
- Fusepkg-configxmlwf
- Gccpm-utilsxorg-x11-server-utils
- Gdbpostfixxsltproc
- Gdbus-bash-completion.shpostgresqlxz
- Genisoimageprocpsyp-tools
- Getentpythonyum. bash
- Gitqdbusyum-utils.bash
- Gpg2quota-tools
At this time, you can implement the Automatic completion function.