Use Linux terminal quick operations to improve work efficiency

Source: Internet
Author: User

Use Linux terminal quick operations to improve work efficiency

Many ordinary Linux desktop users feel rejection and fear of using the terminal. In fact, it is not as complicated as everyone thinks. Many common operations can be done directly on the terminal, for example: install software and upgrade the system.

Whether you are a newbie or an old hacker using Linux terminals, the system geeks here summarize the quick operations to improve the efficiency of terminal command execution, hoping to help you learn and improve efficiency.

Move positioning cursor

It seems inconvenient to move the cursor and position in the terminal. It is not what you think. There are many ways to make the keyboard a good friend, but you only need to master the correct method.

Locate a word

In a long-segment command, you can use Ctrl + ← and Ctrl + → to quickly position the cursor to the first or end of a word in the command, so as to quickly locate the beat between words.

Enter the apt-get install build-essential command in the terminal and press Ctrl + left or Ctrl + right to try the effect.

Locate the beginning and end of a row

You can use Ctrl + A to locate the beginning of the command line, and press Ctrl + E at the end of the line.

Clear part, all, or whole line

You can use the Ctrl + K shortcut to quickly clear all parts after the current cursor position. Ctrl + W can clear a word before the current cursor position, the Ctrl + U command can be directly cleared just after the entire line.

Auto-completion command or path

The tab key can directly complete commands and paths, saving us from many input errors. Of course, it is very convenient to enter the first letter of the command when the command is not fully recorded and use the tab key.

For example, to install the software on Ubuntu, you only need to enter apt-get ins and press tab to complete it into apt-get install.

Input laziness

In Windows and Mac, you are used to clicking the icon to complete various tasks. In the terminal, all tasks must be completed using commands. Fortunately, we have a way to avoid repeated command input over and over again.

Switch recently used commands

In the Linux terminal history, the commands executed by the user are recorded. You only need to press the upper and lower arrows of the keyboard to quickly switch the commands executed.

Forward Replication

!! The two exclamation points directly represent the previous command line. For example, if you want to use sudo to execute the previous command again, you only need to execute the following command:

sudo !!
Execute the specified historical command

If the command you want to repeat is not the previous one, you cannot use it any more !! . Use it now! Start with the preceding command to be repeated.

Copy the previous Parameter

After you copy and paste the folder to a new path, you may need to perform other operations in the directory. You can switch to the directory as follows:

cd !$

Where! $ Indicates the parameter used last time. It is usually used only for directories.

Directory navigation

In the Linux terminal, perform directory navigation and switch or use the cd command. Below we will introduce some common operations on the cd command.

Navigate to a special folder

In Linux, it is a hard task to enter the path when operating folders. However, if you log on to the system through the desktop, you can drag the specified folder into the terminal window without entering the path manually.

Go back to the parent directory

Like Windows, use cd. To switch between folders in the parent directory, use the ../folder name.

Return to the previous directory

If you need to return the last accessed directory when you perform half of the operations, you can use the-break number:

cd -
Other directory navigation operations
  • Cd returned home directory
  • Pwd View Current Directory
  • Cd/return to the root directory (permission required)
Execute multiple commands in multiple tasks

To execute multiple tasks at the same time on a Linux terminal, you only need to use the & symbol to concatenate multiple commands. For example:

apt-get update && apt-get upgrade
Command failed for backup

& The subsequent commands will be executed only when the previous command is successfully executed. If you want to provide a Backup command when the first command fails to be executed, you only need to replace & with |.

Perform tasks in the background

After adding the & symbol to the end of any Linux Command, the task can be executed in the background, which is suitable for tasks with long running time. You can use the jobs command to display tasks executed in the background, or kill the tasks or use the fg command to move them to the foreground.

Summary

The efficient use of Linux terminals is essential and required for every Linuxer. I believe that after having been familiar with the shortcuts mentioned in this article, your Linux operation efficiency will be improved again.

This article permanently updates the link address:

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.