Improved efficiency for Linux terminal shortcut Operations summary

Source: Internet
Author: User

Many ordinary Linux desktop users are to use the terminal feel repulsion and fear, in fact, it is not as complex as everyone think, many common operations can be directly in the terminal, such as: Installation software, upgrade system.

Whether you are a novice or a Linux terminal used by the veteran, the system geek here summarizes the performance of the terminal command to improve the efficiency of the summary, hoping to help you learn and improve efficiency.

Move the positioning cursor

Moving the cursor and positioning in the terminal seems very inconvenient, in fact, not as you think, there are many ways you can make the keyboard a good friend, just need to master the right way.

Positioning words

In long-segment commands, use CTRL +← and CTRL +→ to quickly position the cursor at the beginning or end of a word in a command, enabling fast-beating positioning between words.

You can try to try the effect by pressing CTRL + LEFT or CTRL + right after entering the Apt-get install build-essential command in the terminal.

Locating the beginning and end of a line

You can navigate to the command line by using CTRL + A, and using CTRL + E shortcut keys at the end of the lines.

Clear partial, full, or entire rows

Use CTRL + K shortcuts to quickly clear all parts after the current cursor position, CTRL + W to clear a word before the current cursor position, and CTRL + U to clear directly the entire line of commands.

Auto-complete command or path

The TAB key directly complements the command and path, allowing us to avoid many of the possible input errors. Of course, when the command is not complete, just enter a few initials to use the TAB key to fill, or very convenient.

For example, to install software in Ubuntu, simply enter Apt-get ins and press TAB to complete the Apt-get install.

Input lazy

In Windows and Macs, users are accustomed to doing all the work by clicking on the icon, while in the terminal all tasks are done using commands. Fortunately, we have a way to avoid repeating the command over and over again.

Toggle the most Recently used command

In the terminal history of Linux, the commands executed by the user are noted, and the user simply presses the keyboard ↓, ↑ up and down arrows to quickly switch the executed commands.

Copy forward

!! A double exclamation point directly represents the previous line of command, for example, to repeat the previous command with Sudo, without losing it again, simply by executing the following command:

Sudo!!
Executes the specified history command

If you want to repeat the command is not "previous", you can no longer use!! The Use Now! Follow the preceding command that you want to repeat.

Copy previous parameter

After you copy and paste a folder into a new path, you might want to do something else in the directory, which you can then switch to:

CD!$

Where!$ represents the last parameter used, and is typically used only for catalogs.

Directory Navigation

For directory navigation and switching in Linux terminals or CD commands, here are some common operations for CD commands.

Navigating to special folders

Entering a path when working with folders in Linux is a chore, but if you are logging into the system from the desktop, you can simply drag the specified folder into the terminal window without having to manually enter the path.

Back to Parent Directory

As with Windows, use the CD. Can. If you want to switch between folders in the parent directory, use the. /folder name.

Back to the previous directory

If you are halfway through, you need to go back to the last directory you entered, and you can use – dash:

CD-
Other Directory Navigation operations
    • CD Back home directory
    • PWD View current directory
    • CD/Back to root directory (requires permission)
Multiple tasks Execute multiple commands

To perform multiple tasks simultaneously in a Linux terminal, you can concatenate multiple commands with the && symbol, for example:

Apt-get Update && Apt-get upgrade
Command failed Standby

&& will only continue to execute subsequent commands if the previous command succeeds, and if you want to provide an alternate command when the first command fails, simply replace && with | | Can.

Performing tasks in the background

Add the & symbol at the end of any Linux command to drop this task into the background to perform, which is more suitable for long-running tasks. Tasks performed in the background can be viewed using the jobs command, or you can kill them with kill or move them to the foreground with the FG command.

Summary

The efficient use of Linux terminal is every linuxer must learn and need to master the skills, I believe that the shortcuts mentioned in this article are familiar with, you will be the operation of Linux to improve the efficiency.

Improved efficiency for Linux terminal Quick Action summary

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.