Shell Common shortcut keys

Source: Internet
Author: User

I. Historical order

   History #查看历史命令

  history-c #清空历史命令

  history-w #不等退出, write the history command in the cache directly to the history command to save the file ~/.bash_history

  vim/etc/profile #默认历史命令保存1000条, can be modified histsize save the number of bars (unlimited), the command is saved in the ~/.bash_history file

Invocation of the history command:

1. Up and DOWN ARROW calls

2.!n #执行行号为n行的命令, the command shown in history displays the respective line number

3.!his #执行最后一条以his开头的命令

Command and file completion: Tab

Two. aliases and shortcut keys

  alias VI = "VIM" #定义别名, temporary effect

  alias #查看所有别名

Command execution order:

First-bit execution of commands executed with absolute or relative paths

Second cis-execute alias

Third-level execution of bash internal commands

The first command found in the directory lookup order defined by the $PATH environment variable; echo $PATH; you can see the path of a series of commands, the reason why the system command does not use the path, because the environment variable is set, automatically look for.

To permanently save aliases:

The user edits the . BASHRC file in the home directory and writes alias Vi= ' Vim '.

Vim/root/.bashrc

Vim/home/.bashrc

To delete an alias:

  Unalias VI # Unalias aliases

Bash common shortcut keys:

  Ctrl + C Abort command

  Ctrl + L Clear Screen

  Ctrl + U Delete or cut the cursor before the command

Ctrl + K Delete or cut the contents after the cursor

  Ctrl + y Paste Ctrl + U or CTRL + K cut content

CTRL + R searches through the history command, and when you press CTRL + R, the search interface appears, and the search will be searched from the history command as soon as you enter the content.

  Ctrl + D exits the current terminal (equivalent to exit)

Shell Common shortcut keys

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.