Shortcut keys under the Linux command line

Source: Internet
Author: User

1. Shortcut keys under the command line


Comrades who often work under the command line may use up to two keys, which are used to recall
Historical command; Use the left and right arrows to move the cursor backwards or forwards to modify the last used command. In fact
This is not very efficient, with shortcut keys to improve our efficiency, but also looks
More professional, more awesome, more geek. With these shortcuts in hand, we can do the hands without the key.
The four cute arrows on the keyboard can be completely ignored. When we are skilled, we will be more and more happy
Huan this way.

1.1 Common shortcut keys introduced

Here are some of the shortcut keys that authors use frequently under the command line, which are
Kind of effect, don't believe? You can try it. In fact, Emacs is the command line of the Gnu/linux system.
Settings can be found through files such as/etc/profile or/ETC/BASHRC.

Ctrl + A shortcut key
Here's a can be understood as head. When we press this key combination, the cursor moves from the current position to the starting position of the command line. Don't look at it, try it!


Ctrl+b shortcut keys

The b here can be understood as backward, backwards meaning. Sometimes on the command line, we write the arguments or paths of a command incorrectly, and the general practice is to use the left arrow to move the cursor to the specified position and modify it. In fact, we can use the ctrl+b way to achieve the same effect. Don't look at it, try it!


CTRL + C shortcut keys

This key combination is used to terminate the foreground process that is currently running. In the UNIX environment Advanced Programming book, I see a key combination to terminate the current running process, which is ctrl+\textbackslash\cite{unixenvironment}. Don't look at it, try it!


Ctrl+d shortcut keys

The use of this key combination is also very wide, I mainly use this key combination to quit a program, such as Python, MySQL and so on. At the command line the meaning is different, at this point D can be understood as delete. Pressing this key combination will delete the character at the current cursor. Don't look at it, try it!


Ctrl+e shortcut keys

The e here can be understood as end. When we press this key combination at the command line, our lovely cursor runs to the end of the current command line.


Ctrl+f shortcut keys

Here f can be understood as forward, forward meaning, equivalent to pressing the right arrow. Don't look at it, try it!

ctrl+h shortcut Keys
This key combination is equivalent to the BACKSPACE key on the keyboard. Press this key combination to remove the character backwards from the current cursor. Don't look at it, try it!

ctrl+j shortcut Keys
This key combination is equivalent to the keyboard enter. Press this key combination, which is equivalent to pressing a return ENTER. At the command line of Windows, Ctrl+m appears to be equivalent to the ENTER key. Don't just look at it, try it!

ctrl+k shortcut Keys
The k here can be understood as kill. Pressing this key combination removes all characters from the current cursor to the end of this command line. Don't look at it, try it!

ctrl+l shortcut Keys
The l here can be understood as clear. Pressing this key combination is equivalent to executing the clear command to clear the contents of the current screen. Don't look at it, try it!


CTRL + N shortcut keys

The n here can be understood as next. The function of this key combination is to bring up the next history command, and the corresponding shortcut key ctrl+p is to bring up the previous history command. Instead of the downward arrow. Don't look at it, try it!


Ctrl+p shortcut keys

The n here can be understood as previous. The function of this key combination is to call up the previous history command, and the corresponding shortcut to CTRL + N is to bring up the next history command. Instead of the upward arrow. Don't look at it, try it!

ctrl+r shortcut Keys
This key combination is used to search for previous historical commands. Here the R can be understood as reverse, the reverse meaning. In Emacs for backward search, the corresponding is the Ctrl+s shortcut is a forward search. But ctrl+s in the command line is not the role, but to lock the screen. Don't look at it, try it!


Ctrl+t shortcut keys

This key combination is the position where two adjacent characters are exchanged. Swaps the character at the current cursor and the character that precedes the current cursor. For example, if we accidentally write the clear command as a clera, we do not have to delete the RA two characters, then the correct one. At this point, so that our cursor is located on the character a, so that after the press of this key combination, is not the magic thing happened? Of course, if the cursor is at the end of the line, pressing this key combination will swap two consecutive characters before the cursor. Under Emacs, use Ctrl+x and ctrl+t two combination keys \footnote{first press ctrl+x, then release X, continue to press the CTRL key, and then press the T key, you can complete the operation of the two key combinations. Don't be too troublesome, get used to it. , you can swap the position of the current cursor line with the previous row. Don't look at it, try it!


Ctrl+w shortcut keys

The function of this key combination in Emacs is to cut the text of the selected area. Using the key combination on the command line removes a combination of characters. In other words, delete one letter combination or Word to the left of the cursor. For example, we use the command on this command line as follows, "service Networkrestart", let our cursor in the string after the restart, press the key combination to see what effect? Did you become a service network? It is true that if we use the BACKSPACE key, we need to use the keys 7 times to achieve the effect of a ctrl+w key combination. Well, don't just look and try.


ALT +. Shortcut keys

This key combination is the last parameter to bring up the previous command. If the previous life is "servicenetwork restart", then "restart" is the last parameter. If the next command we're going to need is to use the last parameter of the previous command, you can use this shortcut instead of manually typing "restart", without making an error and saving the number of keystrokes you hit. If we want to restart the httpd service next, just enter "service httpd" and press "ALT +." You can complete the "restart" of the previous command. On some terminals, press "ALT +." The key combination may not work, and you can use "esc+." Combination key instead. In Emacs, the ESC key is equivalent to the ALT key. You can try the effect of the key combination.

This article is from the "Tiandaochouqin" blog, make sure to keep this source http://lavenliu.blog.51cto.com/5060944/1627813

Shortcut keys under the Linux command line

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.