The Centos 6.6 command line implementation cannot implement automatic completion.

Source: Internet
Author: User

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
  1. $ 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
  1. Sudofind/-name 'git-completion *'
  2. /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
  1. Gitrpmlint
  2. Createrepo. bashgvfs-bash-completion.shscl.bash
  3. Dbus-bash-completion.shperfsubversion
  4. Dkmspk-completion.bashyum.bash
  5. Gdbus-bash-completion.shrpmdevtools.bash-completionyum-utils.bash

Install: [python] view plaincopy
  1. Sudoyuminstallbash-completion

View the files under/etc/bash_completion.d:

[Python] view plaincopy
  1. Antgvfs-bash-completion.shrcs
  2. Autoconfgzipredefine_filedir
  3. Automakeiconvrfkill
  4. Bash-builtinsifupdownrpcdebug
  5. Bind-utilsinforpm
  6. Brctliproute2rpmdevtools. bash-completion
  7. Bumblebeeiptablesrpmlint
  8. Bzip2javarsync
  9. Chkconfiglsofsamba
  10. Configurelvmscl. bash
  11. Coreutilslzmaservice
  12. Cpan2distmakesh
  13. Cpiomanshadow
  14. Createrepo. bashmdadmsmartctl
  15. Crontabminicomsqlite3
  16. Cryptsetupmodule-init-toolsssh
  17. Cupsmysqladminstrace
  18. Cvsnet-toolssubversion
  19. Dbus-bash-completion.shnmaptar
  20. Ddntpdatetcpdump
  21. Dhclientopen-iscsiutil-linux
  22. Dkmsopensslwireless-tools
  23. Dvd + rw-toolsperfwodim
  24. E2fsprogsperlwvdial
  25. Findutilspk-completion.bashxmllint
  26. Fusepkg-configxmlwf
  27. Gccpm-utilsxorg-x11-server-utils
  28. Gdbpostfixxsltproc
  29. Gdbus-bash-completion.shpostgresqlxz
  30. Genisoimageprocpsyp-tools
  31. Getentpythonyum. bash
  32. Gitqdbusyum-utils.bash
  33. Gpg2quota-tools

At this time, you can implement the Automatic completion function.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.