Recently found in the work of the regular use of some repetitive commands, regular modification of some long-term, it is necessary to science and the shell Command line some common shortcut keys, so that everyone save time to improve efficiency.
All of the following commands are valid under Linux/unix's shell, which is dominated by bash. In case of discrepancies, take your own server as the subject. The main meaning of Linux in this article refers to the Rhel/centos,unix refers to FreeBSD, which is also the most used version of the server.
Ctrl + a switches to the command line start
This operation is the same as the home implementation, but the home is not available in certain UNIX environments, it can be used, the VIM under Linux is also valid, and in many of the Windows file editors, this is also valid.
Ctrl + E To switch to the end of the command line
This operation is the same as the end implementation, but the end key is not available in some UNIX environments and can be used with this combination; Vim under Linux is also valid, and in many of the Windows file editors, this is also valid.
Ctrl + L Clears the contents of the screen, the effect is the same as clear
Ctrl + U clears the contents before the cut cursor, which is useful, and is also valid in Nslookup. I sometimes see colleagues a word in a word delete shell command, very crash! In fact, it can be done with a CTRL + U.
Ctrl + K cut clears the contents of the cursor
Ctrl + y Paste the character you just deleted, this command is more powerful, the deleted character may be a few strings, but most likely a line of command.
Ctrl + R in the history command to find (this very useful, the input keyword to call up the previous command), this command I strongly recommend, sometimes history more time, want to find a more complex, directly here, the shell will automatically find and call, convenient extremely
Ctrl + C Abort command
Ctrl + D Exit shell,logout
Ctrl + Z to run in the background
However, a process running from CTRL + Z to the background will terminate after the current user exits, so use this as a nohup command &, because the Nohup command is that the process continues to run after the user exits, and now many scripts and commands require that the root exit is still valid.
The following is not too familiar with the people, I used more than the operating mode:
!! Repeat the last command
History displays all of your executed numbering + historical commands. This can match! Edit to execute a command
↑ (ctrl+p) Show previous command
↓ (CTRL + N) Displays the next command
!$ display the last parameter of the system
Finally this is useful, for example I use Cat/etc/sysconfig/iptables first, then I want to use vim to edit. The general practice is to first use ↑ to display the last command, then use home to move to the top of the command, delete the cat, and then enter the VIM command. In fact, you can use Vim!$ instead.
This article is from the "Silencewolf" blog, make sure to keep this source http://silencewolf.blog.51cto.com/5009737/1720648
Often makes Linux shortcuts more productive