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 shortcut operations of Linux terminals to improve efficiency

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces you to improve the efficiency of the Linux terminal shortcut operation respectively, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Many ordinary Linux desktop users feel repulsive and afraid of using the terminal, in fact, it is not as complex as we think, many common operations can be carried out directly in the terminal, such as: install software, upgrade the system and so on.

Whether you are a novice or an old bird using Linux terminals, the editor here summarizes a summary of quick operations to improve the efficiency of terminal command execution, hoping to help you learn and improve efficiency.

Move the positioning cursor

Moving the cursor and positioning in the terminal seems very inconvenient, but it's not what you think. There are many ways to make the keyboard your best friend, but you just need to master the right one.

Locate the word

In long commands, you can use Ctrl + ← and Ctrl + → to quickly position the cursor to the first letter or the end of a word in the command, achieving fast bounce positioning between words.

You can try to enter the apt-get install build-essential command in the terminal, press Ctrl + left button or Ctrl + right button to try the effect.

Locate the beginning and end of a line

You can use Ctrl + An at the beginning of the command line and the Ctrl + E shortcut key at the end of the line.

Clear part, whole, or whole line

Use the Ctrl + K shortcut key 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 the entire line directly.

Automatic completion command or path

The tab key can directly complete commands and paths, eliminating the possibility of a lot of typing errors. Of course, when the command is not fully memorized, it is very convenient to type only a few initials to fill it with the tab key.

For example: to install software in Ubuntu, simply enter apt-get ins and press tab to be completed into apt-get install.

Input laziness

In Windows and Mac, users are used to clicking icons to complete tasks, while in terminals, all tasks are done using commands. Fortunately, we have a way to avoid typing commands over and over again.

Toggle recent commands

The commands executed by the user will be recorded in the terminal history of the Linux, and the user can quickly switch the executed commands by pressing the ↓ and ↑ up and down arrows of the keyboard.

Copy forward

!! Double exclamation points directly indicate the previous command, for example, to repeat the previous command with sudo, you don't need to type it again, just execute the following command:

Sudo!!

Execute the specified history command

If the command you want to repeat is not "previous", you can no longer use it! Yes. Use it now! Just start with the previous command that you want to repeat.

Copy the previous parameter

After copying and pasting the folder to the new path, you may have to do something else in the directory, which you can switch like this:

Cd! $

The! $represents the last used parameter and is usually used only for directories.

Directory navigation

Whether to use the cd command for directory navigation and switching in the Linux terminal, let's introduce some common operations of the cd command.

Navigate to a special folder

Entering a path when manipulating a folder in Linux is a chore, but if you log in to the system through the desktop, you can drag the specified folder directly into the terminal window without having to enter the path manually.

Go back to the superior directory

Like Windows, use cd.. That's it. If you want to switch between folders in the parent directory, use.. / folder name.

Go back to the previous directory

If you are halfway through the operation and need to return to the last directory you entered, you can use-dash:

Cd-

Other directory navigation operations

Cd returns home directory

Pwd view the current directory

Cd / go back to the root directory (permission required)

Multitasking

Execute multiple commands

To perform multiple tasks at the same time in a Linux terminal, simply 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 is successful. If you want to provide a backup command if the first command fails, simply replace & & with | |.

Perform tasks in the background

Add the & symbol to any Linux command to throw this task into the background for execution, which is more suitable for tasks that take a long time to run. You can use the jobs command to display the tasks performed in the background, or you can kill them with kill or move them to the foreground with the fg command.

Summary

The efficient use of Linux terminals is a must and skill that every Linuxer needs to master. I believe that after you are familiar with all the shortcuts mentioned in this article, you will have another improvement in the efficiency of Linux operation.

On improving the efficiency of the Linux terminal shortcut operation which are shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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