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
An associated command, cal, which displays the calendar of the current month by default.
To view the amount of remaining disk space, enter df:
Similarly, to display the amount of free memory, enter the command free.
End the terminal session.
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
• 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".
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
• 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)
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
You can also change the output format to get more details
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).
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.
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.
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.
In-depth study of long format output
Determine the file type (file)
file + file name
Browse the content of the file with less (see the details in the text)
7: Manipulate files and directories
mkdir can create multiple folders at the same time
cp-copy files and directories
mv-move (MV...) can be followed by multiple, they will be put into the last
rm-delete command (deleted files can not be restored, must Be used with caution)
8: Use commands
9: Redirect
·