Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the shortcut keys for Shell programming under Linux

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces what are the shortcut keys for Shell programming under Linux. It is very detailed and has certain reference value. Friends who are interested must finish reading it.

1)!!: repeat the previous instruction

2)! a: repeat the previous instruction headed by a

3)! number: repeat the previous instruction that records the number number in the history table

4)!-number: repeat the previous number instruction

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

6) use the Ctrl + r combination key to enter the historical search mode and query a past instruction in the history table. After finding the command that needs to be repeated, press enter to repeat the command parameters (that is, Article 5 in the previous point)

Ctrl+p repeats the last command

Ctrl+a jumps to the first character

Ctrl+x is the same as above, but pressing it again will return to the original position.

If Ctrl+b moves forward one character without deleting characters

Ctrl+h deletes the previous character

Ctrl+u deletes all characters before the prompt

Ctrl+w ditto

Ctrl+d deletes one character after the prompt or exit or logout

Ctrl+e goes to the end of the character

Ctrl+f moves back one character

Ctrl+k deletes all characters after prompt

Ctrl+k cancel

Ctrl+r looks forward for used commands

Ctrl+o Ctrl+y Ctrl+i Crtl+m, I don't know how to use these four.

Command completion

CTRL-I is equivalent to pressing tab keys.

CTRL-W does not delete all the characters before the cursor, it deletes a word before the cursor

CTRL-P is recall's last command. CTRL-N is recall's next command.

The ESC-F cursor steps forward one word

The ESC-B cursor steps back one word

CTRL-M is equivalent to enter key

CTRL-O is equivalent to enter key

CTRL-V allows the next special character to be inserted in the current position. For example, CTRL-V can insert a character in the current position with an ASCII of 9. Otherwise, the result is usually completed by the command.

CTRL-C undoes the edits of the current command line and starts another line.

CTRL-S temporarily freezes input to the current shell

CTRL-Q thawing

ESC-c capitalizes the first letter of the next word, while the cursor advances one word. If the cursor hovers over a letter of the word, such as the o letter in word, the o letter becomes uppercase.

Instead of w

ESC-u capitalizes all the letters of the next word, while the cursor advances one word. As above, if the cursor is over the letter o, ord capitalizes and w remains the same.

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

Try all the ctrl key combinations of bash and summarize them as follows (all the keys that appear below are ctrl key combinations):

1. U K Y

U removes the previous characters from the cursor (excluding)

K deletes the characters after the cursor (including)

Y paste out the characters you just deleted

2. D H

D delete the characters at the cursor

H deletes a character in front of the cursor

3. An 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 moves the cursor one character to the right

B moves the cursor one character to the left

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 the character before the cursor

Basic skills:

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

Modify the contents of the left and right keypad

Tab completes the command name or directory, file name, not the only one that is pressed twice more, and the list will come out.

! ls repeatedly runs the last command that starts with 'ls'. If ls-l is followed by ls-lcrt, then! ls is equivalent to ls-lcrt

Ls abc.txt

Vi! $

The vi! $in the second line is equivalent to vi abc.txtjournal $equals the parameters of the previous command, and'$'is the last row, column, etc., based on the context.

Ctrl key combination

Ctrl+a: move the cursor to the beginning of the line.

Ctrl+b: move the cursor one letter to the left

Ctrl+c: kill the current process.

Ctrl+d: exits the current Shell.

Ctrl+e: move the cursor to the end of the line.

Ctrl+h: deletes the character before the cursor, the same as the backspace key.

Ctrl+k: clears the cursor to the end of the line.

Ctrl+l: clear the screen, which is equivalent to clear.

Ctrl+r: search for previously typed commands. There will be a prompt to search for bash's history based on the keywords you enter

Ctrl+u: clears everything from the cursor to the beginning of the line.

Ctrl+w: a word before the cursor is removed

Ctrl+t: two characters before swapping the cursor position

Ctrl+y: paste or restore the last deletion

Ctrl+d: delete the letter of the cursor; note the difference from backspace and ctrl+h, which are the characters before the cursor is deleted

Ctrl+f: move the cursor to the right

Ctrl+z: move the current process to the background and restore it using the'fg 'command. For example, top-D1 and then ctrl+z, go to the background, and then fg, restore

Esc combination

Esc+d: a word after the cursor is deleted

Esc+f: skip one word to the right

Esc+b: jump one word to the left

Esc+t: swap the two words before the cursor position.

These are all the contents of the article "what are the shortcut keys for Shell programming under Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report