Linux shortcut key summary

Source: Internet
Author: User

Recently, I found that many colleagues, especially our PHP developers, basically do not use shortcuts in Linux/unix, which seriously affects work efficiency, after each usage, I will describe it in detail.

All of the following commands are valid in Linux/unix shell. bash is the main command here. In case of any discrepancy, your own server shall prevail. Linux mentioned in this article mainly refers to RHEL/CentOS, and unix refers to FreeBSD, which is also the most used version on the server.

Ctrl + a switch to the command line

This operation has the same result as Home, but Home cannot be used in some unix environments, so this combination can be used. vim in Linux is also effective. In addition, this is also effective in many file editors in windows.

Ctrl + e switch to the end of the command line

The result of this operation is the same as that of END, but the End key cannot be used in some unix environments. vim in Linux is also valid. In addition, this is also effective in many file editors in windows.

Ctrl + l clear screen content, equivalent to clear

Ctrl + u clear the content before cutting the cursor

This command is useful in nslookup. I sometimes see my colleague deleting shell commands with one word at a time, which is very bad! In fact, it can be done with a Ctrl + u.

Ctrl + k cut the content after clearing the cursor

Ctrl + y paste the deleted character

This command is powerful. The characters to be deleted may be strings, but it is very likely to be a line of command.

Ctrl + r search in the History command (this is very useful, and the previous command will be called out after the keyword is entered)

I strongly recommend this command. Sometimes there are too many history commands to find a complicated one. Here, shell will automatically find and call the command, which is very convenient.

Ctrl + c terminate command

Ctrl + d Exit shell, logout

Ctrl + z transferred to the background for running

However, the process transferred from Ctrl + z to the backend will be terminated after the current user exits. Therefore, it is better to use the nohup command &, the role of the nohup command is that the process continues to run after the user exits, and many scripts and commands require that the process remain valid when the root user exits.

I am not familiar with the following operations:

!! Repeat the last command

History displays the numbers and history commands you have executed. This can be used together! Edit to execute XX command

← (Ctrl + p) display the previous command

Hide (Ctrl + n) display the next command

! $ Display the latest system parameter

Finally this is useful, for example, I first use cat/etc/sysconfig/network-scripts/ifconfig-eth0, and then I want to edit it with vim. In general, first use the terminal command to display the last command, then use Home to move to the beginning of the command, delete cat, and then enter the vim command. In fact, we can use vim! $.

After the development and administrator master the above usage, the work will be very efficient. At the end of the use, you will inadvertently find that you can easily handle a lot of complicated commands between fingers.

Appendix: shortcuts for Linux desktop environments

The following commands are valid in the Linux/unix desktop environment (gnome). For any discrepancies, refer to your own server:

Alt + F1 is similar to the Windows Win key. Open the "application" menu (Applications) in GNOME)

Alt + F2 is similar to Win + R keys in Windows, and runs applications in GNOME

Ctrl + Alt + D is similar to the Windows Win + D key combination, display Desktop

Ctrl + Alt + L lock the desktop and start the Screen Saver

Alt + Tab is the same as the Alt + Tab combination key in Windows, switching between different program Windows

PrintScreen full screen capture

Alt + PrintScreen capture of current window

Ctrl + Alt + →/← switch between different workstations

Ctrl + Alt + Shift + →/← Move the current window to different workstation

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

Ctrl + Alt + Shift + F7 return to desktop

Ctrl + Alt + Shift + F8 unknown (terminal or analog Terminal)

Window operation shortcut

Alt + F4 close the window

Alt + F5 Cancel to maximize the window (restore the original size of the window)

Alt + F7 move the window (Note: It is invalid when the window is maximized)

Alt + F8 change the window size (Note: It is invalid when the window is maximized)

Alt + F9 minimized window

Alt + F10 maximize window

Alt + Space open the control menu of the window (click the menu icon in the upper left corner of the window)

Common shortcut keys in applications

The following does not apply to all programs. Similar to the shortcut keys in Windows:

Ctrl + N new window

Ctrl + X cut

Ctrl + C copy

Ctrl + V Paste

Ctrl + Z undo the previous operation

Ctrl + Shift + Z redo the one-step Undo operation

Ctrl + S save

File Browser

Ctrl + H show hidden files (switch key)

Ctrl + T create tag

Ctrl + Page Up previous tag

Ctrl + Page Down next tag

Alt + N switch to the nth tag (N is a number)

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.