BASH Shell shortcut

Source: Internet
Author: User

CTRL + P repeat the previous command

CTRL + a jump to the first character

CTRL + x same as above, but once again, it will return to the original location

CTRL + B move one character forward without deleting characters

CTRL + H Delete the previous character

CTRL + u Delete All characters before the prompt

CTRL + W same as above

CTRL + D Delete the character after the prompt, or exit or logout

CTRL + E to the end of the character

CTRL + F move one character behind

CTRL + k Delete All characters after the prompt

CTRL + k cancel

CTRL + R: used commands for forward lookup

CTRL + O Ctrl + y Ctrl + I crtl + M do not know how to use

Command completion

CTRL-I is equivalent to pressing a tab key

The CTRL-W is not removing all characters before the cursor, it removes a word before the cursor

The CTRL-P is recall the previous command, the CTRL-N is recall the next command

ESC-F cursor stepping forward a word

ESC-B cursor stepping backward a word

CTRL-M is equivalent to a carriage return key

CTRL-O is equivalent to a carriage return key

The CTRL-V enables the next special character to be inserted at the current position, for example, a CTRL-V can insert a character at the current position, where ASCII is 9, otherwise the result is usually followed by a command

The CTRL-C removes the edit of the current command line from another line.

The CTRL-S temporarily freezes the input of the Current Shell

CTRL-Q unfreeze

ESC-C: make the first letter of the next word in uppercase, and move the cursor forward to a word. For example, if the cursor stays on a letter of the word, for example, the o letter in the word, the o letter is changed to uppercase.

ESC-u converts all the letters of the next word to uppercase, And the cursor moves forward to a word. Same as above, if the cursor is on the O letter, the Ord is capitalized, and W remains unchanged.

ESC-L is the same as the ESC-U, but make it all lowercase.

I tried all the CTRL keys in bash and summarized them as follows (all the keys listed below are CTRL keys ):

1. U K Y

U deletes the characters before the cursor (not included)

K. Delete characters after the cursor (included)

Y sticks out the deleted characters.

2. d H

D. Delete the character at the cursor.

H. delete a character before the cursor

3. A E

A move the cursor to the beginning of the line

E move the cursor to the end of the row

4. F B

F move the cursor one character to the right

B. move the cursor to the left of a character.

5. N P

N next command

Command on P

6. L

L clear screen

7. r

R search for commands previously entered

8. t

T Replace the character at the cursor with the character before the cursor

Basic skills:

View command history with up/down keys

Left/right key area modification content

Tab to fill in the command name or directory. The file name is not unique. Press twice to display the list.

! Ls re-runs the last command starting with 'LS'. If LS-L is first followed by LS-lcrt, then! Ls, equivalent to LS-lcrt

Ls abc.txt

Vi! $

VI in the second line! $ Is equivalent to VI abc.txt ,! $ Is equal to the parameter of the previous command. '$' is the last row and column in the context.

Ctrl key combination

CTRL + A: move the cursor to the beginning of the line.

CTRL + B: move the cursor to the left

CTRL + C: Kill the current process.

CTRL + D: exit the current shell.

CTRL + E: move the cursor to the end of the row.

CTRL + H: Delete the character before the cursor, which is the same as the backspace key.

CTRL + K: Clear the content from the cursor to the end of the row.

CTRL + L: clear screen, equivalent to clear.

CTRL + R: Search for commands that have been used before. There will be a prompt to search for bash history based on the keyword you entered

CTRL + u: Clear all content from the front of the cursor to the beginning of the line.

CTRL + W: Remove a word before the cursor

CTRL + T: two characters before the cursor position

CTRL + Y: paste or restore the last Deletion

CTRL + D: Delete the letter where the cursor is located. Note the difference with backspace and CTRL + H. The two are the characters before the cursor is deleted.

CTRL + F: move the cursor right

CTRL + Z: run the current process in the background and run the 'fg' command to restore the process. For example, top-D1, CTRL + Z, go to the background, then FG, and restore

ESC combination

ESC + D: delete a word after the cursor

ESC + F: Jump to the right

ESC + B: Jump to the left

ESC + T: swap two words before the cursor position.

Related Article

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.