linxu commonly used commands

https://blog.csdn.net/luansj/article/details/97272672?utm_medium=distribute.pc_relevant.none-task-blog-title-1&spm=1001.2101.3001.4242

1: Command history

If you press the up arrow key, many Linux distributions save the last 500 commands entered by default

2: Move the cursor

3: Try to run some simple commands

Get the current date
Insert picture description here
An associated command, cal, which displays the calendar of the current month by default.
Insert picture description here
To view the amount of remaining disk space, enter df:
Insert picture description here
Similarly, to display the amount of free memory, enter the command free.
Insert picture description here

End the terminal session.
Insert picture description here
Behind the scenes console.
Even if the terminal emulator is not running, there are still several terminal sessions running in the background. They are called virtual terminals or virtual
consoles. In most Linux distributions, these terminal sessions can be accessed by pressing Ctrl-Alt-F1 to Ctrl-Alt-F6
. When a session is accessed, it will display the login prompt box, we need to enter the username and password. To
switch from one virtual console to another, press Alt and F1-F6 (one of them) . Return to the graphical desktop and press Alt-F7 .

4: Jump in the file system

• pwd — print out the name of the current working directory
Insert picture description here

• cd — change the directory (enter the specified directory, this function is also applicable in cmd, for windows users, it is recommended to use cmd commands, which is cool after all)
One of the path names is an absolute path, and the other is a relative path
The absolute path starts at the root directory, followed by the branches of the directory tree, until it reaches the desired directory or file. For example,
there is a directory in your system, and most system programs are installed in this directory. The path name of this directory is /usr/
bin. It means that starting from the root directory (indicated by the "/" at the beginning), there is a directory called "data" that contains the directory "elk".
Insert picture description here
Insert picture description here

Relative path : An absolute path starts from the root directory and reaches its destination, while a relative path starts from the working directory. In order to do this (indicated by relative
paths), we use a pair of special symbols in the file system tree to indicate relative positions. The pair of special symbols are "." (dot) and "..." (dot).
eg: Go back to the previous command
Insert picture description here

• ls —List the contents of the directory (in fact, you can use the ls command to list the contents of any directory, not just the contents of the current working directory, use ls -a to list hidden directories)
Insert picture description here

You can even list the contents of multiple specified directories. In this example, the user's home directory (represented by the characters "∼"
) and the contents of the /usr directory will be listed

Insert picture description here
You can also change the output format to get more details
Insert picture description here

5: Understanding the file system tree

Linux organizes all files in a hierarchical directory structure (first level directory: root directory, all directories under this directory: subdirectories).

Insert picture description here
The structure tree is as shown above: the file system tree displayed by the graphical file manager

Linux commands do not have specific graphics, we use pwd (print working directory (abbreviation)) command to display the current working directory.
Insert picture description here

6: Options and parameters

The options used by most commands consist of a midline and a character, for example, "-l", but many commands,
including those from the GNU project, also support long options, which consist of two midlines. Line plus one word. Of course,
many commands also allow multiple short options to be used together. In the following example, the ls command has two options, the "l" option produces output in
growth format, and the "t" option is sorted by file modification time.
Insert picture description here
The above proof is that the default reverse sort
ls command has a large number of options. Table 4-1 lists the most commonly used options.
Insert picture description here

Insert picture description here
In-depth study of long format output

Determine the file type (file)
file + file name
Insert picture description here
Browse the content of the file with less (see the details in the text)
Insert picture description here

7: Manipulate files and directories

Insert picture description here
mkdir can create multiple folders at the same time
Insert picture description here
cp-copy files and directories
Insert picture description here
mv-move (MV...) can be followed by multiple, they will be put into the last
Insert picture description here
rm-delete command (deleted files can not be restored, must Be used with caution)
Insert picture description here

8: Use commands

Insert picture description here

9: Redirect

Insert picture description here
·

Guess you like

Origin blog.csdn.net/m0_49056832/article/details/109116976