stay Linux An engineer working in an environment , I'm sure I'll be impressed by those tedious instructions and parameter command lines . and , What's terrible is not fussy , It's a lot of typing these tedious commands over and over again .

stay Linux We have an alias command  alias , You can customize those tedious commands as aliases that we can remember easily , It can greatly improve our efficiency .

however ,alias The command is only valid for the current terminal , When the terminal is closed , All the aliases we set are invalid . So if you want to make these aliases permanent , We need to add them to the  
.bash_profile  In the file .

In this article , Liang Xu will introduce 10 It's very practical , Command aliases that improve your efficiency .

1.

Compressed package file , especially tar File in Linux It's very widely used in many situations , however tar There are many command options , It's not easy to remember . So we can define several common options as an alias  
untar , So we need to decompress tar File time , direct  untar filename  that will do .
alias untar='tar -zxvf ' Copy code
2.

When we download a large file , Suddenly, the network was interrupted , Is it crazy for us to download again ? don't worry , ours wget There is an order -c
option , Support breakpoint Download , We can also set it as an alias :
alias wget='wget -c ' Copy code
3.

Sometimes we need to generate one 20 A random number password with two characters , We can use it openssl command , But the complete command is very long and inconvenient , We can set aliases :
alias getpass="openssl rand -base64 20" Copy code
4.

After downloading a file , We'd like to check its accuracy checksum value , You can encapsulate this command as an alias  sha , After that, we  sha filename  You can check the file's
checksum value .
alias sha='shasum -a 256 ' Copy code
5.

Under normal circumstances ,ping The command will be output infinitely , But it doesn't make much sense . We can use it -c The command limits it to 5 Secondary output , Then set it as an alias  ping , In use ,ping url
  that will do .
alias ping='ping -c 5' Copy code
6.

If we want to start one anytime, anywhere web The server , We can use this alias :
alias www='python -m SimpleHTTPServer 8000' Copy code
7.

Network speed test is often used in work , but Linux There are no built-in commands available , We can use third-party tools  speedtest-cli . This tool can be downloaded directly from Github
Download , How to use it is also described in detail . We need to use it first  speedtest-cli  Command to select the nearest server , Then set the following alias :
alias speed='speedtest-cli --server 2406 --simple' Copy code
8.

Your public network IP How much is it ? Good memory can be memorized directly , But if you do 10
Hundreds of servers ? You can recite it , Then take part in the strongest brain training . In fact, there is a command that you can query directly , But that order is too perverse , It's hard to remember , Set as alias .
alias ipe='curl ipinfo.io/ip' Copy code
9.

How to know your LAN IP ? This command is also abnormal , Set alias decisively .
alias ipi='ipconfig getifaddr en0' Copy code
10.

last , Clear screen , We can use it  ctrl + l  Shortcut key , You can also  clear  The command is defined shorter , This is more direct to use , More rough .
alias c='clear' Copy code
this 10 You don't have to use all of them , Because you use it Linux
We're going in different directions , The work content is different . In your field of work, there must be a lot of complex commands that can be defined as aliases , Welcome to add in the message area !

last , Recently, a lot of little friends come to me for help Linux Learning Roadmap
, So I learned from my own experience , I stayed up late for a month in my spare time , Organized an e-book . Whether you're interviewing or promoting yourself , I believe it will help you ! The contents are as follows :

It's for free , Please give me a compliment !

link :pan.baidu.com/s/1_6uniaFV…  Extraction code :9pbc

Also hope to have a small partner to join me , Make this e-book more perfect !

Technology