Centos 6.6 command line for Automatic completion, centos6.6
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
$ git clone https://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:
sudo find / -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:
git rpmlintcreaterepo.bash gvfs-bash-completion.sh scl.bashdbus-bash-completion.sh perf subversiondkms pk-completion.bash yum.bashgdbus-bash-completion.sh rpmdevtools.bash-completion yum-utils.bash
Installation:
sudo yum install bash-completion
View the files under/etc/bash_completion.d:
ant gvfs-bash-completion.sh rcsautoconf gzip redefine_filedirautomake iconv rfkillbash-builtins ifupdown rpcdebugbind-utils info rpmbrctl iproute2 rpmdevtools.bash-completionbumblebee iptables rpmlintbzip2 java rsyncchkconfig lsof sambaconfigure lvm scl.bashcoreutils lzma servicecpan2dist make shcpio man shadowcreaterepo.bash mdadm smartctlcrontab minicom sqlite3cryptsetup module-init-tools sshcups mysqladmin stracecvs net-tools subversiondbus-bash-completion.sh nmap tardd ntpdate tcpdumpdhclient open-iscsi util-linuxdkms openssl wireless-toolsdvd+rw-tools perf wodime2fsprogs perl wvdialfindutils pk-completion.bash xmllintfuse pkg-config xmlwfgcc pm-utils xorg-x11-server-utilsgdb postfix xsltprocgdbus-bash-completion.sh postgresql xzgenisoimage procps yp-toolsgetent python yum.bashgit qdbus yum-utils.bashgpg2 quota-tools
At this time, you can implement the Automatic completion function.