字数
381 字
阅读时间
3 分钟
Linux Entry Tutorial
The following content is adapted from the operating system course website by jyy, with some modifications and additions. If you are using Linux for the first time, please read the tutorial carefully while trying out the commands mentioned in the tutorial.
Exploring the Command Line
The command format for Linux commands is similar:
bash
command_name parameter1 parameter2 parameter3 ..
Parameters are separated by any number of spaces. To learn about commands, you can first read some basic concepts. Then we will introduce some commonly used commands:
ls
lists the files (or directories) under the current directory (i.e., "folder"). Directories are displayed in blue.ls -l
can display detailed information.pwd
displays the current working directory.cd DIR
can change the directory toDIR
. In Linux, each directory contains at least two special entries:.
refers to the current directory itself, and..
refers to the parent directory. The root directory of the file system is/
.touch NEWFILE
can create an empty file namedNEWFILE
; ifNEWFILE
already exists, its content will not be lost.cp SOURCE DEST
can copy theSOURCE
file toDEST
; ifDEST
is a directory,SOURCE
will be copied into this directory.mv SOURCE DEST
can renameSOURCE
toDEST
; ifDEST
is a directory,SOURCE
will be moved into this directory.mkdir DIR
can create a directoryDIR
.rm FILE
can delete theFILE
file; if the-r
option is used, it can recursively delete a directory. Deleted files cannot be recovered, so please use with caution!man COMMAND
can view the help for theCOMMAND
command. For example,man ls
can view how to use thels
command. Useman
and search the internet flexibly to quickly learn new commands.
The function of man
is not limited to this. man
can be followed by two parameters to view help for different types (please search the internet for details). For example, if you don't know how to use the standard C library function fopen
, you can type man 3 fopen
to view it.