Fedorasudo command to completely extend bash-completion

Source: Internet
Author: User
One of the advantages of Linux over DOS is that it has the command complementing function. However, in Fedora or CentOS, after sudo is used, it is impossible to use TAB for command completion, let alone parameter completion. In fact, Bashshell 2.05 and later versions support the script-based Extended Instruction Set (commandcompletion). In Ubuntu, this function is supported by default, however, this function is not available in the default Fedora system.

One of the advantages of Linux over DOS is that it has the command complementing function. However, in Fedora or CentOS, after sudo is used, it is impossible to use TAB for command completion, let alone parameter completion.

In fact, Bash shell 2.05 and later versions support script-based extension of the Instruction Set (command completion). In Ubuntu, this function is supported by default, however, this function is not available in the Fedora system by default. To complete commands and command parameters in the sudo environment, install bash-completion first.

Bash-completion: a bash shell script that contains a large number of command modes.

Installation:

Sudo yum install bash-completion

Edit the. bashrc file and add:

# Use bash-completion, if available

If [-f/etc/bash_completion]; then

./Etc/bash_completion

Fi

Then execute:

Source/etc/bash_completion

Now we have all the completion functions of sudo + command + TAB.

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.