C-a |
Move the cursor to the beginning of the line (under command) |
C-b |
BACKSPACE (non-destructive), this just moves the cursor position back one position. |
C-c |
Interrupt. End a foreground job. |
C-d |
Exit from a shell (similar to exit). " EOF (End of File: End of file). It is also used to indicate the end of standard input (stdin). When you enter text in the console or Xterm window, c-d deletes the character under the cursor. If no characters exist, c-d logs out of the session. In a xterm window, the effect of closing this window is generated. |
C-e |
Move the cursor to the end of the line (command line) |
C-f |
Move the cursor forward one character (command line) |
C-g |
BEL. On some older printer terminals, this raises a bell. May be a beep on the xterm terminal. |
H |
Erase (Rubout) (destructive backspace). While the cursor is moving back, erase one character before the cursor.
Code
123456789101112131415161718192021222324 |
#!/bin/bash
## 可以尝试下下面的代码
## C-H的表现也许和你想象的不一样
## 本例来自Advanced Bash-Scripting Guide
## 注意:因为中文原因,下面的^位置可能会出现漂移
a=
"^H^H"
echo "abcdef"
echo
echo -n
"abcdef$a "
# abcd f
# 末尾有个空格 ^ ^ 两次C-H的结果
echo
echo -n
"abcdef$a"
# abcdef
# 末尾没有空格 ^ 显示效果是没有按C-H?(为什么?).
# 这个结果和我们预期的不一致.
echo
;
echo
rubout=
"^H^H^H^H^H" # 5个C-H.
## 来吧,让我们看看真相:
echo -n
"12345678"
sleep 2
echo -n
"$rubout"
sleep 2
## 现在,你知道真相了么?
|
|
C-i |
Horizontal tab. |
C-j |
New lines (line feed) and start at the beginning. In the script, it may also be represented as an octal form (' \012 ') or hexadecimal (' \x0a '). |
c-k |
Vertical tab (Vertical tab.). When you enter text in the console or Xterm window, C-k removes all characters from the cursor to the end of the line. In the script, ctrl-k may have different behavior, the following example gives its different behavior:
code
123456789101112 |
#!/bin/bash ## A c-k vertical tab example var=$ ' \x0abottom line\x0btop line\x0a ' ## Direct output echo ## use Col to filter control characters echo "$var" | Col ## the above display will be different exit 0 |
|
C-l |
Skip the paper, change the page (formfeed), clear the screen. Clear the terminal screen. On the terminal, this command acts like a clear command. But when this command is sent to the printer, Ctrl-l jumps directly to the end of the paper (Paper sheet). |
C-m |
Enter (carriage return). |
C-n |
Erases a line of text recalled from the history buffer (at the command line). If the current input is selected in the history, this is from this history, not pressed once, is closer to a command |
C-o |
Generate a new Line (command line) |
C-p |
Recall the last Command (command line) from the history buffer. The order of this shortcut was recalled by from near, that is, by pressing once, recalling the previous command, and then pressing it again, the previous command was recalled, and the c-n is starting with the current input, but the two commands operate just the opposite, and the c-n is starting from the beginning by far and near (if the beginning is the historical command). |
C-q |
Resume (XON). Restore/Thaw, this command is used to restore the terminal's stdin, see C-s |
C-r |
Backtracking search (backwards search) text in the history buffer (command line), note: After pressing, the prompt becomes (reverse-i-search) ': The entered search content appears in single quotation marks, and the most recent matching history command appears after the colon |
C-s |
Suspend (XOFF), hangs, this is the stdin that freezes the terminal. To recover you can press C-Q. |
C-t |
Swaps the character contents of the cursor position with the previous position of the cursor (command line). For example echo $var; , assuming that the cursor is on a, then when C-T is pressed, V and a will swap positions. |
C-u |
Erases all character content from the cursor position to the beginning of the line. Under certain settings, C-u does not remove input from the entire row with the cursor position as a reference. |
D-1 |
When you enter text, you can insert a control character after you press C-V. For example: As echo -e ‘\x0a‘; with echo <C-V><C-J>; these two effects. This feature works well in a text editor. |
C-w |
When you type text in the console or in a xterm window, C-w removes the contents from the first white space character that is back at the cursor. In some settings, C-w removes the character from the cursor (back) to the first non-literal and number. |
C-x |
In some word-processing programs, this control character will cut the highlighted text and copy it to the Clipboard. |
C-y |
Paste the previously cleared text back (primarily for c-u or c-w). |
C-z |
Pauses a foreground job, and also acts as a replacement in some text handlers, and as EOF (End-of-file) characters in the Msdos file system. |
C-\ |
Exit. Similar to c-c, you may dump a "core" file into your working directory (this file may not work for you) |
c-/ |
Undo action, Undo. |
C-_ |
Undo Action |
C-xx |
Switch between the beginning of the line and the cursor two positions, here are two "X" characters |
|
M-b |
The cursor jumps back one word, and the word is bounded by non-letters (jumping to the beginning of the word where the cursor is currently located). |
M-f |
The cursor jumps forward one word (moves to the end of the word where the cursor is located) |
M-d |
Delete all content at the end of the word where the cursor is located (or delete the entire word if the cursor is at the beginning of the word) |
M-del |
Del is the BACKSPACE key, which deletes everything from the position of the cursor to the beginning of the word. |
M-c |
Capitalize the letter at the position of the cursor (if the cursor is in or before the beginning of a word, capitalize the first letter of the word) |
M-u |
Capitalize all letters in the position of the cursor to the ending |
M-l |
Turn all the letters from the cursor position to the ending to lowercase |
M-r |
Cancels all changes and restores the current row to its original state in the history (provided the current command is from the history, and if it is entered manually, the row is emptied). |
M-t |
When words are present on both sides of the cursor, swap the positions of the words on both sides of the cursor. such as: abc <M-T>bcd bcd abc |
M-. |
Use the last word of the previous command (the command itself is also a word, see the word indicator concept in the Bang command in the following article) |
M-_ |
With M-. |
M-no. |
m+ number, this number can be positive or negative, this key alone has no effect, must be followed by other content, if the following is a character, then the number of repetitions, such as: [m-10,k] The cursor position will be inserted 10 k characters (negative value in this case is invalid); The number affects the execution of subsequent commands, such as: [M--10,c-d] performs 10 operations in the direction of the opposite (negative) direction of the c-d default. |
m-< |
Moves to the first line of the history Record command. |
M-> |
Moves to the last line of history, which is currently being entered (null if no input is present) |
M-p |
Search forward from the current line, and it is necessary to move to up, and use non-incremental search to find the user-supplied string when moving. |
M-n |
Searches backward from the current line and, if necessary, moves to "down", using a non-incremental search to find the user-supplied string. |
M-c-y |
Inserts the first parameter of the previous command (usually the second word in the previous line) on the flag point. If there is a parameter n, insert the nth Word of the previous command (the word number from the previous line starts with 0, see history extension). A negative argument inserts the nth word that starts at the end of the previous command. The parameter n is passed through m-no, such as: [M-0,m-c-y] Inserts the NO. 0 Word of the previous command (the command itself). |
M-y |
Polls to the delete ring and copies the new top text. Use this command only after Yank[c-y]] or yank-pop[m-y]. |
M-? |
Lists the entries that can be complete before the Mark Point |
m-* |
Put possible-completions[m-?] The command can generate all the text entries that are inserted before the flag point. |
m-/ |
An attempt was made to complete the file name of the text before the flag point. [c-x,/] treats the text before the marker as a file name and lists the entries that can be complete. |
m-~ |
Use the text in front of the logo as the user name and try to complete the completion. [c-x,~] Lists the entries that can be used as the user name complement flag point. |
m-$ |
Think of the text before the mark point as a shell variable and try to complete the completion. [c-x,$] Lists the entries that can be used as the variable complement flag point. |
[Email protected] |
The text before the mark Point is treated as a hostname and attempted to complete. [c-x,@] Lists the entries that can be used as the host complement flag point. |
m-! |
The text before the mark Point is treated as a command name and attempted to complete. The command name completion is followed by the alias, reserved word, shell function, shell internal command, and finally the executable file name. [c-x,!] The text in front of the mark Point is listed as the command name and a complete entry is made. |
M-tab |
Compare the text in front of the mark point to the text in the history to find a match and try to complete the completion. |
m-{ |
Complete the file name, and put the list of entries that can be complete between the braces so that the shell can use it. |