Linux shortcut keys are often used to improve work efficiency.
I recently found that some repetitive commands are frequently used in my work, and some long Ming commands are frequently modified. I feel that it is necessary to popularize some common shortcuts of shell command lines, so that you can save time and improve work efficiency. All of the following commands are valid in Linux/unix shell. bash is the main command here. In case of any discrepancy, your own server shall prevail. Linux mentioned in this article mainly refers to RHEL/CentOS, and unix refers to FreeBSD, which is also the most used version on the server. Ctrl + a switch to the command line to start this operation with the same result as Home implementation, but Home cannot be used in some unix environments, you can use this combination; vim in Linux, this is also effective; in addition, it is also effective in many file editors in windows. Ctrl + e switch to the END of the command line. This operation has the same result as the End implementation. However, the END key cannot be used in some unix environments. In the Linux vim, this is also effective; in addition, it is also effective in many file editors in windows. Ctrl + l clear the screen content. The effect is equivalent to clear Ctrl + u to clear the content before cutting the cursor. This command is useful and works in nslookup. I sometimes see my colleague deleting shell commands with one word at a time, which is very bad! In fact, it can be done with a Ctrl + u. Ctrl + k cut the content after the cursor is cleared Ctrl + y paste the deleted characters, this command is more powerful, delete characters may be several strings, but most likely a line of command. Ctrl + r search in the history command (this is very useful, and the previous command is called after you enter the keyword). I strongly recommend this command. Sometimes there are many history commands, I want to find a complicated one. Here, the shell will automatically find and call it. It is very convenient to press Ctrl + c to terminate the command Ctrl + d to exit the shell. logout Ctrl + z cannot be transferred to the background, the process transferred from Ctrl + z to the background will be terminated after the current user exits. Therefore, use the nohup command instead &, the role of the nohup command is that the process continues to run after the user exits, and many scripts and commands require that the process remain valid when the root user exits. I am not very familiar with the following examples :!! Repeat the last command history to display all your executed numbers + history commands. This can be used together! Edit to execute the XX command Ctrl + p to display the previous command Ctrl + n to display the next command! $ Display the latest system parameter. For example, I first use cat/etc/sysconfig/iptables, and then I want to use vim to edit it. In general, first use the terminal command to display the last command, then use Home to move to the beginning of the command, delete cat, and then enter the vim command. In fact, we can use vim! $.