Summary of ten Linux command aliases that can improve efficiency

Summary of ten Linux command aliases that can improve efficiency

Preface

Engineers working in the Linux environment will surely be impressed by those cumbersome instructions and parameter command lines. What's scary is not the tediousness, but the need to repeatedly enter these tedious commands.

In Linux, we have an alias command, which can customize those cumbersome commands into aliases that are easy for us to remember, which can greatly improve our efficiency.

However, the alias command is only valid for the current terminal. When the terminal is closed, all the aliases we set will become invalid. So if we want these aliases to be permanent, we need to add them to the .bash_profile file.

In this article, Liang Xu will introduce 10 very practical command aliases that can improve your work efficiency.

1. Compressed files, especially tar files, are widely used in Linux, but the tar command has many options and is not easy to remember. So we can define several commonly used options as an alias untar, so that when we need to decompress the tar file, we can directly use untar filename.

alias untar='tar -zxvf '

2. When we are downloading a large file, the network is suddenly interrupted. Wouldn’t it be frustrating if we have to download it again? Don't worry, our wget command has a -c option that supports breakpoint downloads, and we can also set it as an alias:

alias wget='wget -c '

3. Sometimes we need to generate a 20-character random 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 can verify the checksum value of the file by sha filename.

alias sha='shasum -a 256 '

5. Under normal circumstances, the ping command will output infinitely, but it doesn’t really make sense. We can use the -c command to limit it to 5 outputs, and then set it as an alias ping. When using it, just ping the URL.

alias ping='ping -c 5'

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

alias www='python -m SimpleHTTPServer 8000'

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

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

8. What is your public IP? Those with a good memory can memorize it directly, but what if you have 10 or hundreds of servers? You can also memorize it and then participate in the Brainiest Contest. In fact, there is a command that can query directly, but that command is too abnormal and difficult to remember, so I decisively set it as an alias.

alias ipe='curl ipinfo.io/ip'

9. How do I know my LAN IP? This command is also abnormal, decisively setting an alias.

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 is more direct and rough to use.

alias c='clear'

You may not be able to use all of these 10 commands, because everyone uses Linux in different ways and has different work content. There must be a lot of complex and tedious commands in your work field that can be defined as aliases. You are welcome to add them in the comment area!

Summarize

This concludes this article about ten Linux command aliases that can improve efficiency. For more relevant Linux command aliases, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Linux command to decompress rpm package and introduction to rpm command usage
  • Extract specific file paths in folders based on Linux commands
  • The difference and usage of Ctrl+z, Ctrl+c and Ctrl+d in Linux commands
  • Example code of Linux command to create date folder or file
  • How to save command output to a file in Linux terminal
  • The most comprehensive collection of commonly used Linux commands (with examples)

<<:  mysql replace part of the field content and mysql replace function replace()

>>:  Vue Getting Started with Weather Forecast

Recommend

Example of creating circular scrolling progress bar animation using CSS3

theme Today I will teach you how to create a circ...

Using CSS to implement image frame animation and curve motion

The basic principle of all animations is to displ...

Things to note when migrating MySQL to 8.0 (summary)

Password Mode PDO::__construct(): The server requ...

Detailed explanation of JavaScript's built-in objects Math and strings

Table of contents Math Objects Common properties ...

Vue implements card flip carousel display

Vue card flip carousel display, while switching d...

jQuery achieves breathing carousel effect

This article shares the specific code of jQuery t...

Detailed steps for developing WeChat mini-programs using Typescript

We don't need to elaborate too much on the ad...

Javascript basics about built-in objects

Table of contents 1. Introduction to built-in obj...

Implementation of multi-environment configuration (.env) of vue project

Table of contents What is multi-environment confi...

Vue uses element-ui to implement menu navigation

This article shares the specific code of Vue usin...

Vue computed properties

Table of contents 1. Basic Examples 2. Computed p...

MySQL table name case selection

Table of contents 1. Parameters that determine ca...