Small knowledge, big challenge! This article is part of the “Programmer’s Essentials

This article also participated in the “Digitalstar Project” to win a creative gift package and creative incentive money

Most of the server programs are deployed on Linux. I have never encountered the scenario of setting up a server on Windows or MAC, so I often need to operate Linux in my work, deploy on the server, check problems and read logs. These routine operations need to be familiar with Linux commands. Have their English prototype, hope can help memorization, quick mastery.

1. General commands

1, the ls (list)

Displays files or directories

-l Lists the file details l(list)

-a Lists all files and directories in the current directory, including hidden a(all)

2、mkdir ( make directory)

Create a directory

-p Creates a directory. If there is no parent directory, create p(parent).

In the xC directory under the working directory, create a subdirectory named test.

If the xC directory does not already exist, create one. (Note: In this example, if -p is not added and the original XC directory does not exist, an error occurs.)

mkdir -p xc/test
Copy the code

3, rmdir (remove directory)

Deleting an Empty Directory

4, CD (change directory)

Switch directory

5, touch

Creating an empty file

6, echo

Print a command to enter a line of text and display it on standard output

Echo parsleyCopy the code

7. Cat (Concatenat)

View the file contents and display the entire file at once.

 cat   filename
Copy the code

8、cp ( copy)

copy

[options] source dest cp xiangcai. TXT/TMP /Copy the code

9、mv ( move)

Move or rename

The command format is mv a bCopy the code

10, rm (remove)

Delete the file

-r Indicates recursive deletion. Subdirectories and files can be deleted

-f Forcible deletion

11, the find

Search for a file in the file system

12, wc

Count the number of lines, words, and characters in the text

13, grep

Find a string in a text file

14 and the tree

The tree structure displays directories. You need to install the tree package

15、pwd ( print work directory)

Show current directory

16, ln (link)

Creating a link file

17, More, less

Pagination displays text file contents

18, head, tail

Displays the header and tail of a file

19, df (disk free)

Displays file system disk usage statistics on Linux.

20, DU (Disk Usage)

This command is used to view the disk space occupied by files or directories

21, PS (Process Status)

Using the ps command, you can list the processes that are currently running in the system. The ps command lists snapshots of the current processes,

22, chown change owner)

Chown Changes the owner of a specified file to a specified user or group. The user can be a user name or user ID. A group can be a group name or a group ID. Files are a list of files whose permissions are to be changed separated by Spaces. Wildcard characters are supported. System administrators often use the chown command to grant permission to use a file after copying it to another user’s directory.

23, chmod (change mode)

Chmod Is used to change the permission of a file or directory. Common permissions for files or directories

24, su = switch user

2. View the command usage

The above knowledge briefly introduces commands, but the specific use of each command is not detailed. It is better to teach a man to fish than to teach him to fish. Here is a general way.

On the cli, enter the –help command to view the instructions of the command.

find --help
Copy the code