Linux shell Programming Shortcuts Daquan (daily collation) _linux Shell

Source: Internet
Author: User
Tags clear screen

Sometimes we need to repeat the previous commands in Bash. You can, of course, use the UP ARROW keys to view the commands you've run before. But there are some better ways, for example, to master the following shortcuts.

1)!! : Repeat the previous instruction

2)!a: Repeated execution of the previous directive with a LED

3)!number: Repeat execution of the previous instruction in the history table recording number

4)!-number: Repeated execution of the previous number of instructions

5)!$: means to get the last item in the previous command

6 with CTRL + R key to enter the history of search mode in the history table to query a past instruction, find the need to repeat the command, press ENTER to repeat the command parameters (that is, the 5th of the previous point)

Ctrl+p Repeat Last Command

CTRL + a jumps before the first character

Ctrl+x ditto but press once again will return to the original position

Ctrl+b move one character forward without deleting characters

Ctrl+h Delete previous character

Ctrl+u all characters before the prompt is deleted

Ctrl+w ditto

Ctrl+d a character or exit or logout after deleting a prompt

Ctrl+e go to character tail

Ctrl+f Move one character back

Ctrl+k all characters after a prompt is removed

Ctrl+k canceled.

Ctrl+r look forward to the used command

Ctrl+o ctrl+y Ctrl+i crtl+m These 4 are not clear how to use

<TAB> orders to be padded

Ctrl-i equivalent to pressing tabs <TAB> keys

Ctrl-w is not the deletion of all characters before the cursor, it deletes a word before the cursor

Ctrl-p is recall out the previous command <===> Ctrl-n is recall out the next command

ESC-F cursor step forward one word

Esc-b cursor step back into one word

Ctrl-m equivalent to enter

Ctrl-o equivalent to enter

CTRL-V enables the next special character to be inserted in the current position, such as ctrl-v <TAB> can insert a <TAB> character in its current position, its ASCII is 9, otherwise generally press <TAB> result is ordered to be padded

Ctrl-c undo the edit of the current command line, and start the other line.

Ctrl-s temporarily freezes the current shell's input

CTRL-Q Thaw

Esc-c the first letter of the next word, and the cursor advances a word, such as the cursor resting on one of the letters of the word, such as the O letter in Word, the letter O is capitalized.

And not W.

Esc-u makes all letters in the next word uppercase, while the cursor advances a word, ditto, such as the cursor on the O letter, the Ord is capitalized, W is unchanged.

Esc-l with Esc-u, but make it all lowercase.

Try all the CTRL keys in bash, and now summarize the following (all the keys that appear are the CTRL key combination):

1. U K Y

U remove previous characters from the cursor (excluding)

K Delete the characters after the cursor (including)

Y Glue the characters you just deleted.

2. D H

D Delete the characters at the cursor

H Delete one 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 line

4. F B

F move the cursor to the right one character position

b position the cursor to the left one character

5. N P

N Next command

P Previous Command

6. L

L Clear Screen

7. R

R Search for previously entered commands

8. T

T replaces the character at the cursor with a character before the cursor

Basic:

Look at the history of the command with the up and down keys

Left and right key area modify content

tab-padded command name or directory, file name, not the only 2 more times, will come out of the list

!ls repeats the last command that starts with ' ls ', if first ls-l then Ls-lcrt, then!ls, equivalent to LS-LCRT

LS Abc.txt

VI!$

The second line of the VI!$ equivalent to the VI abc.txt,!$ equals the previous command parameters, ' $ ' is based on the context of the last row, column and so on.

CTRL key combination

CTRL + A: The cursor moves to the beginning of the line.

CTRL+B: The cursor moves one letter to the left

CTRL + C: kills the current process.

Ctrl+d: Exits the current Shell.

Ctrl+e: The cursor moves to the end of the line.

Ctrl+h: Deletes a character before the cursor, same as the BACKSPACE key.

Ctrl+k: Clears the contents of the cursor to the end of the line.

Ctrl+l: Clear screen.

Ctrl+r: Search for commands that you've called before. There will be a hint, based on the keyword you entered, to search Bash's history.

Ctrl+u: Clears all content before the cursor to the beginning of the line.

Ctrl+w: Remove a word before the cursor

Ctrl+t: Two characters before swapping the cursor position

Ctrl+y: Paste or redo the last deletion

Ctrl+d: Deletes the letter where the cursor is located; Note the difference between backspace and ctrl+h, these 2 are the characters before the cursor is deleted

CTRL+F: The cursor moves right

Ctrl+z: Move the current process to the background and use the ' FG ' command to recover. Like Top-d1 and then ctrl+z, to the backstage, then FG, and back

ESC Combination

Esc+d: Delete A word after the cursor

Esc+f: Jump Right One word

Esc+b: Jump to the left one word

Esc+t: Two words before swapping the position of the cursor.

The above content is small to share the Linux Shell Programming shortcut key Encyclopedia (daily collation), I hope to help you!

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.