Summary of common Linux commands

    I believe that everyone is no stranger to Linux. Many students have headaches when learning Linux, feel that it is difficult to learn, and cannot remember many commands. In fact, when we are learning Linux, we should use our brains as memory, and Not a hard drive.

help command

    There are many commands in Linux, and commands also have many parameters, so how do we learn? We can use the help documentation, here are 3 help commands:

 Man: man is the abbreviation of manual. If you have a problem, find a man. It was a joke at the time.

    The use of the man command is also very simple, an example is as follows:

man ls

man is also a command, divided into 9 chapters, you can use the man command to get help from man:

man man
command format
Terminal commands consist of:

command [-options] [parameter]

command: command name,

[-options]: options, there can be zero, one or more options, multiple options can be combined, the options of the command are used to adjust the function of the command

[parameter]: parameter, there can be zero, one or more parameters, the parameter is the operation object of the command, general files, directories, users and processes can be operated by the command as parameters

[]: represents optional


view directory command

    In Linux, everything is a file, and there is no concept of drive letter in Linux. All files are in the root directory. Next, let's take a look at the commands to view the directory.

    ls command: List the contents of the folder, ls can only view one level of directory information:

ls # View the contents of the current folder

ls /bin # View the files in the bin directory


    tree command: Display directory information in a tree-like manner, and tree can view multi-level directory information.

tree # Display the current directory information in a tree view
tree /bin # If you are prompted that there is no tree command, you can install it through apt install tree


    pwd command: View the current directory path, which is the abbreviation of print work directory.

switch directory command

    cd command: switch directory, which is the abbreviation of change directory.


touch command: create the specified file

touch abc.txt # Files in Linux can have no suffix

touch a b c # Can create multiple files at once


mkdir command: create a directory (folder)

mkdir movie # Create the movie directory

mkdir a b c # Create a b c directory

If I want to create a two-level directory, try:

mkdir movie/active # Want to create the active directory under movie, and the movie directory has not been created mkdir: cannot create directory 'movie/active': No such file or directory

This is what we can do with the option -p:

mkdir movie/active -p # There is no order between options and parameters, you can write that first


rm command: delete the specified file or directory

rmdir command: remove empty directories


Copy, move files and directories commands

    cp command: copy files, copy directories

   mv command: move files, move directories, rename


View file content command
cat command: display text content to the terminal

     head command: view the beginning of a file

   tail command: view end of file

   wc command: statistics file content information


Compress and decompress commands

  tar 命令:压缩和解压缩命令

 Compress into a .gz file:

tar -zcvf backup.tar.gz *.txt

Extract the .gz file:

tar -zxvf backup.tar.gz


Unzip to the specified directory:

tar -zxvf backup.tar.gz -C /tmp/


User and User Group Management

    useradd command: create (add) a user

   groupadd command: create (add) user groups


file permission command

   Chmod: Change file permissions



network management

  ifconfig command: configure and display the network parameters of the Linux system network card

  ip Command: Network Configuration Tool

  ping command: test network connectivity between hosts

  telnet command: log in to the remote host and manage (test whether the IP port is connected)

  traceroute command: show the path of packets to the host

  netstat command: View network system status information in Linux

  ss command: Another tool included with the iproute2 package that allows you to query statistics about sockets.

  nc command: used to set up the router

 host command: commonly used analysis domain name query tool

 nslookup command: tool for querying domain name DNS information


package manager

  apt-get installation: apt-get install package_name

  Yum installation: yum install package_name


Process related

  ps command: command used to report the process status of the current system

  pstree command: show the derivation relationship between processes in the form of a tree diagram

  kill command: send relevant signals to achieve different stopping effects for the process

 top command: display or manage running programs


memory check command

  free command: display memory usage



Service management tool

   systemctl Command: System Service Manager Commands




Original article, please indicate the source for reprinting: