On Linux systems, when you type a command and press TAB twice, all available commands starting with the characters you type are listed. This is not new, you may already know. This feature is called command line completion bash completion. By default, the bash command line can automatically complete file or directory names. However, we can enhance the bash command completion function and bring it to a new level with the complete command.
This tutorial shows how we can apply auto-completion to options or command line arguments using programmable command completion.
Example: After you enter the write command, if you press the TAB button twice, the auto-completion feature provides a list of users who can perform write operations. $ write [TAB][TAB]bala rajjason randyjohn ritumayla thomasnisha www-data
In the following example, the available hostname can be displayed for the telnet command: $ telnet [TAB][TAB]localhost dev-db Fileserver
To make the programmable command completion function work on your terminal, you only need to execute /etc/bash_completion as follows: # . /etc/bash_completion
You can also cancel The following comment in /etc/bash.bashrc (from Ubuntu Linux 13.04 system), so you don't need to execute the above command: ### enable bash completion in interactive shellsif ! shopt -oq posix; thenif [ -f /usr/share/bash-completion/bash_completion ]; then. /usr/share/bash-completion/bash_completionelif [ -f /etc/bash_completion ]; then. /etc/bash_completionfifi
If you don't find these The code, did not find the /etc/bash_completion file, then you only need to install the bash_completion package by using the apt-get command.
1. View existing command line completions
After enabling the programmable command line completion function, there are already some defined command completion functions. The complete command is used to define command line completion.
To see the existing command line completion, use the complete command as follows: complete -p
Computer Store News: According to the latest report from a German technology website, Valves Steam B
Linux kernel is very stable, but it is still inevitable to encounter a crash, get the memory image w
Microsoft announced the extension of the Windows Vista and Windows 7 lifecycle. The life cycle of W
According to foreign media reports, Linux does not seem to be fully loved by people. Operating syste
Analysis of the application of Linux system in DVR equipment
Add and remove programs via three-party software in Linux
Inux system management and maintenance - ifconfig command
Explain the ADSL dial-up method under Linux system
Design and Implementation of Linux-based Cluster Management System
Several commonly used Linux operating system monitoring scripts
Correct understanding of Linux memory usage is too high
Linux auto-execute crontab study notes
Java can not handle graphics solutions under Linux
Repairing Vista with Startup Repair
How to implement Windows 7/Vista boot automatically login without entering password
Win8 corresponds to UEFI fast boot method
How to modify Win7 default shortcut key
Multi-system installation using a little pass skills
LOL point a set of word activities how to set the word LOL fast set word method
The method of clearing the less common application under win8 system
Win7 system batch end running program to release computer performance
Win10 activation tool one-click activation method 2 (with win10 one-click activation tool download)