Get the App
SLTechnology News&Howtos  ›  Servers  › 

What are the ways to organize Linux commands

Shulou Source: shulou.com Published: 2022-06-01 08:20:04 10月01日 Update

This article mainly explains "what are the ways to organize Linux commands". Friends who are interested may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the ways to organize Linux commands"?

1. Switch back to the previous directory

The code is as follows:

Cd-

The bar represents the path to the previous directory

-it's actually a built-in variable $owd

2. Replace a phrase in the previous command

The code is as follows:

^ Foo ^ bar^

The original style of this command should be

The code is as follows:

!!: gs/foo/bar/

!! Means to repeat the previous command and replace it with: gs/foo/bar.

3. Back up a file quickly

The code is as follows:

Cp filename {, .bak}

Curly braces are the meaning of an arrangement, so try the following example

The code is as follows:

Echo {a,b,c} {a,b,c} {a,b,c}

The full arrangement of three sets will be output

The code is as follows:

Aaa aab aac aba abb abc aca acb acc

Baa bab bac bba bbb bbc bca bcb bcc

Caa cab cac cba cbb cbc cca ccb ccc

4. Empty or create a file

The code is as follows:

: > file.txt

: is an empty function that exists by default in shell

5 、 reset

The code is as follows:

Rest

If you have tried to accidentally cat a certain binary file, it is very likely that the whole terminal will be silly, may not be able to break lines, cannot be echoed, a lot of garbled code and so on, you can type in the reset command, regardless of whether the command is displayed or not, it will return to normal.

6. More friendly display of the currently mounted file system

The code is as follows:

Mount | column-t

At this point, I believe you have a deeper understanding of "what are the ways to organize Linux commands". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Command code method file content actual directory previous learning original practical deeper three garbled binary representative interest function variable backup Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn MySQL MariaDB Huawei Shulou Tech Info