Learn common Linux command lines

Preamble: It is necessary for programmers to master basic Linux commands. You can familiarize yourself with common Linux commands through the following articles.

1. Ls (View all content)

When you want to view all contents of the current path (excluding hidden ones)

2, create a folder

When you want to create a folder,

3. PWD (View current directory)

When you want to view the current directory,

4. CD (switch file path)

When you want to switch to the specified file path, for example, I want to switch to the test folder under the current path

5, CD.. / (return to previous directory)

Let’s say I want to go back to the previous directory

6, rmdir (delete empty directory)

If I want to delete an empty directory, the deletion will fail.

7, Touch (create file)

Let’s say I want to create an A.txt file in the test folder

8, vi (edit file)

Suppose I want to add data to a.txt

Press A on the keyboard to start inserting data

Press esc in the upper left corner of the keyboard and enter **:eq** to exit the vi editor

Note: To save an unnamed VIm, use **:file a.txt (a.txt is the file name) **

9. Mv (Modify file name or move file)

Suppose we want to change the name of the file a.txt to b.txt

Suppose we want to move the b.txt file to the test2 folder

10, cp (copy files)

Let’s say we want to copy a file named b_copy.txt

11, rm(delete file)

Suppose we want to delete the b_copy. TXT file

If we want to delete a folder containing files,rm -rf

12. Cat (View file contents)

Let’s say we want to go straight to the file

13, tail -n (check the last n lines of the file)

If you want to see the last n lines of the file

14, grep(search for the specified string)

Suppose you want to find the row where all occurrences of a specified string occur

15, tar(create, view, extract tar compressed file)

Tar -cvf creates a compressed file. Suppose we want to compress the hello. TXT file into hello.tar

Tar -tvf View the compressed file

Tar -xvf Extract compressed files

16. Gzip (Create and extract zip files)

Create a gzip file

Extract the Gzip file

17, ping (check the connection status with the IP address of a server)

18, uname -a (displays system information, including kernel name, host name, kernel version, etc.)

19, df(Check disk usage in file system)

20, PS (display the running process of the system)

To be continued…