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 Shell shortcut key operations under Linux/Unix?

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Editor to share with you what the Shell shortcut key operation under Linux/Unix, I believe most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Sometimes we need to repeat the previous command in Bash. Of course, you can use the up arrow to view commands that have been run before. But here are some better ways:

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 content of * 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)

Let's take a look at an example: mkdir / exampledircd! $

In this case, the * line command creates a directory, while the command on the second line goes to the directory you just created.

Here, the function of "! $" is to repeat the parameters of the previous command.

In fact, not only the parameters of the command can be repeated, but the options of the command can also be repeated.

In addition, Esc +. Keyboard shortcuts toggle these command parameters or options.

Shortcut key Ctrl + a for editing:

Position the cursor at the beginning of the command Ctrl + e:

Contrary to the previous shortcut, position the cursor at the end of the command Ctrl + u:

Cut the content before the cursor Ctrl + k:

Contrary to the previous shortcut, cut the content after the cursor Ctrl + y:

Paste the content cut by Ctrl + u and Ctrl + k Ctrl + t:

Swap the order of the first two characters of the cursor Ctrl + w:

Delete the parameter (option) or content Ctrl + l to the left of the cursor:

Clear screen Ctrl + d: input is over.

Under shell, it is equivalent to an exitCtrl + c: keyboard interrupt request.

Ctrl + s & Ctrl + Q:

Pause / resume screen output Ctrl + n (↓):

Display the next command Ctrl + p (↑):

Display the previous command Ctrl + b:

Move Ctrl + f back:

Move Ctrl + shift + ↓ forward:

The terminal scrolls down Ctrl + shift + ↑:

The terminal scrolls up the Shift+pgup/pgdown:

The terminal turns the page up and down and scrolls the job.

First, use the Ctrl + z shortcut key to suspend the executing command. If you want the process to execute in the background, you can execute the bg command. The fg command brings the process back to the foreground.

Using the jobs command, you can see which processes are executing in the background.

You can also use the assignment id in the fg or bg command

For example: fg% 3

Another example: bg% 7 uses the replacement command to replace

Let's first look at the example: du-h-a-c $(find. -name * .conf 2 > & -)

Notice the section in $(), which tells Bash to run the find command and then take the returned result as an argument to du.

Process replacement

Let's take a look at the example: diff tempfile1 cat tempfile1 | command1 | command2 | … | | commandN > |

Redirection and combination

Example of redirecting flow: ps aux 2 > & 1 | grep init

The numbers here represent: in the command above 0:stdin1:stdout2:sterr, "grep init" searches not only for the standard output of "ps aux", but also for sterr output.

You can also append these outputs to an existing file: ps aux "filename

You can also split a longer line: command1 | command2 |... | | commandN > tempfile1 cat tempfile1 | command1 | command2 | … | | | commandN > |

Some commonly used shortcut keys in Ubuntu:

Window management Win+E displays all desktops for easy left and right selection.

Ctrl + Alt + → / ← switch between different workbench

Ctrl + Alt + Shift + → / ← move the current window to a different workbench

Alt + Shift+ ↑ displays the current window in a cool way

Ctrl + Alt + D display Desktop / restore current window

Alt+ Tab switch window

Alt + F4 close window

Alt + F5 cancel the window (restore the original size of the window)

Alt + F7 Mobile window (Note: it is not valid when the window is changed)

Alt + F8 resizes the window (note: it is not valid when the window is *).

Alt + F9 minimize window

Alt + F10 * * window

Alt + Space opens the control menu of the window (click the menu that appears on the icon in the upper left corner of the window)

Ctrl+Alt+F7 returns to the desktop

File browser NautilusShift+Ctrl+N new folder, very useful

Alt + Enter to view the properties of the selected file / folder instead of right-clicking to select properties

Ctrl + 1 move 2 change the way the folder view is viewed, icon view / list view

Ctrl + W closes the current Nautilus tag

Ctrl + Shift + W close all Nautilus tags

Ctrl+T creates a new tag in Nautilus

A tag on Ctrl+Page Up

Ctrl+Page Down next label

Alt + ↑ / ↓ move to parent folder / selected folder

Alt + → / ← back / forward

Alt + Home moves directly to the home folder

Alt+N switches to the Nth label (N is numeric)

F9 switch shows hidden Nautilus sidebar

Ctrl + H switch shows hidden folders

Ctrl+N, a common shortcut key in applications, to create a new window.

Ctrl+X shear

Ctrl+C replication

Ctrl+V paste

Ctrl+Z undoes the previous operation

Ctrl+Shift+Z redoes the step that was just undone

Ctrl+S save

Other Ctrl + Alt + L lock screens

Alt + F1 opens the application menu

Alt + F2 opens the run Application dialog box

Win + mouse wheel zoom in / out screen

PrintScreen full screen screenshot

Screenshot of Alt + PrintScreen current window

Ctrl+Alt+Shift+Fn terminal N or analog terminal N (n and N are digital 1-6)

The above is all the contents of the article "what are the Shell shortcut key operations under Linux/Unix?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more 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

Servers

Wechat

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

12
Report