Enhance Bash Functions

Source: Internet
Author: User

The following two tips to enhance Bash functions: one is to improve Bash command history management, and the other is to enable Bash to have a more intelligent automatic completion feature. The implementation process is not complex. You only need to modify the default configuration of Bash. Improve Bash command History Management: The default configuration of Bash has a problem. If you open two (or more) consoles at the same time, the commands executed on these two consoles are not shared to history. Some command history may even be overwritten. To solve this problem, add the following content ~ /. Bashrc or ~ /. In the bash_profile file, the first sentence of 1 shopt-s histappend2PROMPT_COMMAND = 'History-a' is used to append the command to history. The second sentence is to save history when a command prompt is displayed. Set intelligent auto-completion: In Bash, you can press the Tab key to enjoy the auto-completion feature. With the following settings, you can use the Up and Down keys to select the parameters after the command. In. inputrc (if the file does not exist, create one) with the following content: 1 "\ e [A": history-search-backward2 "\ e [B ": the first two sentences of history-search-forward3set show-all-if-ambiguous on use Up and Down to search in history. The next sentence is automatically completed by pressing Tab. If Ctrl-R is used together, it is easier to use.

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.