It is highly recommended for heavy Linux command-line users to install ZSH or fish.

  • ZSH installation and plug-in installation are available hereBlog.csdn.net/I_lost/arti…

    Note this is required after ZSH or oh-my-zsh is installedreboot
  • ZSH plug-ins must be installed
  1. Incr automatic completion
Mkdir ~/.oh-my-zsh/plugins/incr wget http://mimosa-pudica.net/src/incr-0.2.zsh -o ~/.oh-my-zsh/plugins/incr/incr.plugin.zshCopy the code
  1. ZSH -syntax-highlighting grammar
  2. Zsh-autosuggestions History

Common Linux Commands

port

  • ss -lntExample Query all enabled ports

Linux information

  • lsb_release -aCan list all version information

sudo

  • su gitSwitch to the git account
  • sudo -iTo frequently execute certain permissions that only super users can execute without entering a password every time, run this command. Example If you are prompted to enter the password, the password is the password of the current account. There is no time limit. After the command is executed, the prompt changes to # instead of $. To logout of a normal account, you can run exit or logout.

    Refer to the link

ls

  • ls -lhH File size

The history command

  • historyPrint history command
  • Ctrl + R Searches for historical commands. After entering keywords, you can press Ctrl + R again to search for matching commands
  • !!!!!Press Tab to display the last command
  • ! gitEnter and press Tab to display the last command that starts with git
  • ! 2901Enter and press Tab to display command 2901 in the history list
  • Press the up and down arrow keys

Create a batch

  • mkdir 202004{01.. 30}Create 30 directories in a batch

Delete a file or directory

  • rm -rf testDelete the test directory
  • rm -f test.hDelete the test.h file

-f: Forcible deletion. -r: indicates recursive deletion

Check whether a proxy server is connected to the terminal

  • curl cip.cc
  • orcurl www.google.com

Set the proxy for the terminal

  • Add the following script to.bash_profile
function proxy_off() {unset http_proxy
        unset https_proxy
        unset ftp_proxy
        unset rsync_proxy
        echo -e "Closed agent"
}
 
function proxy_on() {
        export no_proxy="Localhost, 127.0.0.1, localaddress, localdomain.com"
        export http_proxy="http://127.0.0.1:8001"
        export https_proxy=$http_proxy
        export ftp_proxy=$http_proxy
        export rsync_proxy=$http_proxy
        export HTTP_PROXY=$http_proxy
        export HTTPS_PROXY=$http_proxy
        export FTP_PROXY=$http_proxy
        export RSYNC_PROXY=$http_proxy
        echo -e "Agent enabled"
}
Copy the code
  • performsource .bash_profile
  • performproxy_on
  • performcurl cip.cc“To check whether the configuration is successful