Get the App
SLTechnology News&Howtos  ›  Servers  › 

Summarize ten Linux command aliases that can improve efficiency

Shulou Source: shulou.com Published: 2022-06-02 13:41:25 10月04日 Update

This article mainly summarizes ten Linux command aliases that can improve efficiency, the content is clear and clear, interested friends can learn, I believe it will be helpful after reading.

Preface

Engineers working in Linux must be impressed by the tedious command lines of instructions and parameters. Moreover, the scary thing is not tedious, but the need to re-enter a large number of these cumbersome commands.

Under Linux we have an individual name command alias, which can customize those tedious commands to aliases that we can easily remember, which can greatly improve our efficiency.

However, the alias command is only valid for the current terminal, and when the terminal is closed, all aliases we set are invalid. So if we want these aliases to last forever, we need to add them to the .bash _ profile file.

In this article, Liangxu will introduce 10 command aliases that are very practical and can improve your productivity.

1. Compressed package files, especially tar files, are widely used under Linux, but there are many options for the tar command, which are difficult to remember. So we can define several commonly used options as an alias untar, so that when we need to extract the tar file, we can simply untar filename it.

Alias untar='tar-zxvf'

2. When we were downloading a large file, suddenly the network was abnormally interrupted. Are we crazy to download it again? Don't worry, our wget command has a-c option that supports breakpoint downloads, or we can set it as an alias:

Alias wget='wget-c'

3. Sometimes we need to generate a 20-character random number password. We can use the openssl command, but the complete command is very long and inconvenient. We can set an alias:

Alias getpass= "openssl rand-base64 20"

4. After downloading a file, we want to verify its checksum value. We can encapsulate this command as an alias sha, and then we sha filename can verify the checksum value of the file.

Alias sha='shasum-a 256'

5. Normally, the ping command will be output an unlimited number of times, but it doesn't make much sense. We can use the-c command to limit it to five outputs, then set it to the alias ping, and when using it, ping url.

Alias ping='ping-c 5'

6. If we want to start a web server anytime, anywhere, we can use this alias:

Alias www='python-m SimpleHTTPServer 8000'

7. Network speed testing is also often used at work, but Linux does not have its own commands available, so we can use the third-party tool speedtest-cli. This tool can be downloaded directly from Github and is described in detail in how to use it. We need to first use the speedtest-cli command to select the closest server to us, and then set the following alias:

Alias speed='speedtest-cli-server 2406-simple'

8. What is your public network IP? If you have a good memory, you can memorize it directly, but what if you have 10 servers on 100 servers? You can also memorize it and participate in the strongest brain. In fact, there is a command that can be queried directly, but that command is too abnormal to remember, so it is decisively set as an alias.

Alias ipe='curl ipinfo.io/ip'

9. How to know your own local area network IP? This command is also perverted, decisively setting aliases.

Alias ipi='ipconfig getifaddr en0'

10. Finally, to clear the screen, we can use the ctrl + l shortcut key, or we can define the clear command shorter, which makes it more direct and rough to use.

Alias clockwise clear'

You may not be able to use all of these 10 commands, because people use Linux in different directions and work in different ways. In your field of work, there must be a large number of complex and tedious commands that can be defined as aliases, welcome to add in the message area!

After reading the above content, do you have a better understanding of summarizing ten Linux command aliases that can improve efficiency? if you want to learn more, you are welcome to follow the industry information channel.

Tags: Commands aliases files tedious work efficiency content servers services effective decisive bad perverted tools terminals learning output scary complex the strongest Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MariaDB Huawei OPPO Reno Redmi