"Linux" shell Linux/unix under the shell shortcut operation large set __linux

Source: Internet
Author: User
Tags clear screen

Sometimes we need to repeat the previous commands in Bash. You can certainly use the UP ARROW keys to view the commands you've run before, but this article describes some of the better ways, such as!!,!a,!number,!-number,!$,ctrl+r shortcuts. This article also provides examples of how to use these shortcuts correctly.

AD:

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 here are some better ways:

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)

First look at an example: Mkdir/exampledircd!$

In this case, the first line of command creates a directory, and the second row of commands moves to the directory you just created.

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

In fact, not only are the command parameters repeatable, but the command options are also available.

In addition, ESC +. Shortcut keys can toggle these command parameters or options.

Shortcut keys for editing CTRL + A:

Position the cursor at the beginning of the command CTRL + E:

In contrast to the previous shortcut key, position the cursor to the end of the command CTRL + U:

Before you cut the cursor Ctrl + K:

In contrast to the previous shortcut key, the contents of the cut cursor Ctrl + Y:

Paste Ctrl + U and CTRL + K cut content Ctrl + T:

Swap the cursor before the two-character order Ctrl + W:

Delete the parameters (options) or contents CTRL + L: left of the cursor

Clear Screen Ctrl + D: the input has ended.

Under the shell is equivalent to a Exitctrl + C: Keyboard interrupt request.

Ctrl + s &ctrl + Q:

Pause/Resume Screen Output CTRL + N (↓):

Show next Command CTRL + P (↑):

Show previous Command CTRL + B:

Move Ctrl + F to back:

Move CTRL + Shift +↓ forward:

The terminal scrolls down CTRL + Shift +↑:

The terminal scrolls up Shift+pgup/pgdown:

Terminal up and down scrolling processing job

First, you can use the Ctrl + Z shortcut keys to suspend the command you are executing. If you want the process to execute in the background, you can execute the BG command. The FG command can bring the process back to the foreground.

Use the jobs command to see which processes are executing in the background.

You can also use the job ID in FG or BG commands,

such as: FG%3

Another example: BG%7 using permutation command substitution

First look at the example: Du-h-a-c $ (find.-name *.conf 2>&-)

Note the section in $ (), which tells Bash to run the Find command and then return the result as a parameter to Du.

Process substitution

Still first look at the example: diff < (PS Axo comm) < (sshuser@host PS Axo comm)

This command compares the processes that are running on both the local system and the remote system.

Please note the section in < ().

Xargs See example:

Find. -name *.conf-print0 | xargs-0 grep-l-Z mem_limit | xargs-0-i CP {}

{}.bak This command backs up all. conf files in the current directory.

Using pipelines

The following is a simple example of using a pipe:

PS aux | grep init here,

| The operator redirects the output of the PS aux to grep init.

Here are two examples of slightly more complex points:

PS aux | Tee FileName | grep init and: PS aux | tee-a FileName | grep init saves standard output as a file you can save the standard output of a command to a file.

Examples are as follows: PS aux >filename Note the ">" symbol.

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 >

Redirection and Grouping

Example of a redirect stream: ps aux 2>&1 | grep Init

The numbers here represent: in the 0:stdin1:stdout2:sterr above command, "grep init" not only searches for "PS aux" standard output, but also searches 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 of the most commonly used shortcut keys in Ubuntu:

Window Management Win+e display all desktops, convenient left and right choice.

Ctrl + Alt +→/← Switch between different workstations

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

ALT + shift+↑ Display the current window in a cool way

Ctrl + Alt + D Show Desktop/restore Current window

ALT + Tab Toggle window

Alt + F4 Close window

Alt + F5 Cancel Maximize window (Restore window original size)

Alt + F7 Move window (note: Invalid when window is maximized)

Alt + F8 Change window size (Note: Invalid in window maximized state)

Alt + F9 Minimized window

ALT + F10 Maximize window

Alt + Space Open the Control menu of the window (click on the menu that appears in the top left corner of the window)

CTRL+ALT+F7 Return to Desktop

File Browser nautilusshift+ctrl+n new folder, useful

Alt + Enter View the properties of the Select File/folder instead of right-clicking to select Properties

Ctrl + 1/2 Change the way Folders view view, Icon View/List view

Ctrl + W Close current Nautilus label

Ctrl + Shift + W Close all Nautilus labels

Ctrl+t a new label in Nautilus

Ctrl+page up previous label

Ctrl+page down next label

Alt +↑/↓ Move to parent folder/Selected folder

Alt +→/← Back/forward

Alt + Home Move directly to main folder

Alt+n Switch to Nth tab (n is number)

F9 switch shows hidden nautilus Sidebar

Ctrl + H switch shows hidden folders

Common shortcut keys in applications CTRL + N Create a new window

Ctrl+x Shearing

CTRL + C copy

Ctrl + V Paste

Ctrl+z Undo Previous Action

Ctrl+shift+z Redo a step that has just been undone

Ctrl+s Save

Other CTRL + ALT + L lock screen

ALT + F1 Open Application Menu

Alt + F2 Open the Run Application dialog box

Win + mouse wheel zoom/Zoom screen

Printscreen Full Screen screenshot

Alt + printscreen Current Window screenshot

CTRL+ALT+SHIFT+FN terminal n or analog terminal n (n and N for number 1-6)

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.