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