Common Directory
/
root directory/root
root user's home directory/home/username
Ordinary user's home directory/etc
configuration file directory/bin
command directory/sbin
management command directory/usr/bin
/usr/sbin
Other pre-installed directories
Help command
Use the help command to check the usage of a command in detail, linux
are many 061d32b9f29b8d commands, and the reasonable use of the help command will help us improve efficiency.
Common help commands are
man
helphelp
helpinfo
help
man help
Before use, you can use the following command to install the Chinese manual of man
yum install -y man-pages-zh-CN
man
+ digital + file / command you want to view, for example linux
which contains both a call passwd
files and command, according to the following man
help of view, man 1 passwd
representatives view passwd
help command, and man 4 passwd
representatives passwd
help file .
1 Commands
用户可从 shell 运行的命令
2 System calls
必须由内核完成的功能
3 Library calls
大多数 libc 函数,例如 qsort(3))
4 Special files
/dev) 目录中的文件
5 File formats and conventions
/etc/passwd 等人类可读的文件的格式说明
6 Games
7 Macro packages and conventions
文件系统标准描述,网络协议,ASCII 和其他字符集,还有你眼前这份文档以及其他东西
8 System management commands
类似 mount(8) 等命令,大部分只能由 root 执行
9 Kernel routines
这是废弃的章节。
原来曾想把一些关于核心的文件放在这里,但是实际上只有极少数可以写成文件放在这里,而且它们也很快过时了。
核心开发者可以找到其他更好的资源。
Help
- Internal commands use
help
help
For example:help cd
- External commands use
help
help
For example:ls --help
What are internal commands and external commands? The commands that come with shell
are called internal commands, and the others are external commands.
Use the type + command to check whether it is an internal command. For
cd is a shell builtin
shows that cd
[root@VM-24-13-centos ~]# type cd
cd is a shell builtin
[root@VM-24-13-centos ~]# type ls
ls is aliased to `ls --color=auto'
Info help
It is help
, as a supplement.
File operation commands
ls command
ls
displays the files and folders in the current folder
ls + folder directory displays the files and folders in the specified file directory
ls /data /tmp /dev
can simultaneously view multiple directories, such as the beginning of the command can be displayed simultaneously data
tmp
dev
following.
ls -l
long format display
- The first group is the format and permissions of the
-
first character 061d32b9f29fad represents the file type, andd
represents the folder. - The second set of data is a number representing how many files there are under this file, 1 means that this is only one file, and if it is not 1, it means that it is a folder.
- The third set of data represents who created the file.
- The fourth group of data represents which user group the user who created this file belongs to.
- The fifth set of data represents the current file size, the unit is
byte
. - The sixth set of data represents the last modification time.
- The seventh set of data represents the file name.
-rw-r--r-- 1 root root 14985 12月 27 21:45 404.html
-rw-r--r-- 1 root root 631 12月 27 21:45 apple-touch-icon.png
drwxrwxrwx 6 root root 4096 12月 12 21:10 assets
-rw-r--r-- 1 root root 11 12月 27 21:45 CNAME
-rw-r--r-- 1 root root 631 12月 27 21:45 favicon.ico
-rw-r--r-- 1 root root 7294 12月 27 21:45 index.html
-rw-r--r-- 1 root root 1062 12月 27 21:45 LICENSE
drwxrwxrwx 8 root root 4096 12月 21 00:01 MongoDB文档数据库
drwxrwxrwx 6 root root 4096 12月 27 21:46 netty高性能网络框架
drwxrwxrwx 6 root root 4096 12月 24 09:28 Netty高性能网络框架
-rw-r--r-- 1 root root 77 12月 27 21:46 udownload.bat
-rw-r--r-- 1 root root 66 12月 27 21:46 upload.bat
drwxrwxrwx 4 root root 4096 12月 18 01:20 生活日记
ls -a
shows all files, including hidden files.
ls -r
displayed in reverse.
ls -t
according to the creation time.
For example, the following ls -l -r -t
represents reverse sorting according to the creation time, which is equivalent to ls -lrt
it is not reversed, it should be the latest modified first.
[root@VM-24-13-centos home.pages]# ls -lrt
总用量 68
drwxrwxrwx 6 root root 4096 12月 12 21:10 assets
drwxrwxrwx 4 root root 4096 12月 18 01:20 生活日记
drwxrwxrwx 8 root root 4096 12月 21 00:01 MongoDB文档数据库
drwxrwxrwx 6 root root 4096 12月 24 09:28 Netty高性能网络框架
-rw-r--r-- 1 root root 14985 12月 27 21:45 404.html
-rw-r--r-- 1 root root 631 12月 27 21:45 apple-touch-icon.png
-rw-r--r-- 1 root root 11 12月 27 21:45 CNAME
-rw-r--r-- 1 root root 631 12月 27 21:45 favicon.ico
-rw-r--r-- 1 root root 7294 12月 27 21:45 index.html
-rw-r--r-- 1 root root 1062 12月 27 21:45 LICENSE
drwxrwxrwx 6 root root 4096 12月 27 21:46 netty高性能网络框架
-rw-r--r-- 1 root root 77 12月 27 21:46 udownload.bat
-rw-r--r-- 1 root root 66 12月 27 21:46 upload.bat
ls -R
recursive display
ls -ld
View folder information
ls -lh
displays the file size in a more friendly way K
M
G
.
mkdir command
mkdir folder name to create a folder.
mikdir -p folder name/...recursively create a folder.
cp command
cp file folder Copy a file to the corresponding folder.
cp -r folder folder Copy the folder to a folder,
-r
still plays a recursive role.
cp -p The information such as the creation time when the file folder is copied remains unchanged.
cp -a When the file folder is copied, the authority user information will not change.
mv command
mv a b
directory unchanged is equivalent to modifying the name.
mv a ../b
equivalent to moving a to... and modifying the name to b.
Text view command
cat command
cat file outputs all the contents of the text.
cat -s Converts continuous blank lines into one blank line when outputting the content of the file.
cat -b When outputting text content in a file, add a line number before non-blank lines.
cat -n file output text content all line front home number.
head command
head file output text content from the beginning, the default is 10 lines.
161d32b9f2a3e4 head -n output n lines from the
tail command
tail file outputs text content from the end, 10 lines by default.
tail -n output n lines of text from the end of the file.
tail -f file outputs the file content from the end and tracks real-time text content updates.
tail -fn200 The file outputs 200 lines of text from the end and traces it.
wc command
wc file outputs four information:
text lines
Number of text words
Number of text bytes
File name
wc -c file text bytes
wc -w file text word count
wc -l file text line number
wc -L The length of the longest line in the file text
more command
more File to view text content by line
Pack and compress commands
tar command
package
tar cf .../name.tar -C The directory to be packaged Pack a directory into a
tar
to a certain folder c
represents the creation of the f
representative file.
compressed
tar zcf .../name.tar.gz -C The directory to be packaged
z
represents compression, instead of gzip
, sometimes tar.gz
will also be abbreviated to tgz
tar jcf .../name.tar.bz2 -C The directory to be packaged
j
represents compression, instead of bzip2
, sometimes tar.bz2
will also be abbreviated to tbz2
, bzip
, which takes a longer time to compress the file.
unzip package
tar xf ...tar
the packaged file
tar zxf ...tar.gz
packaged and compressed gzip
file decompression
tar jxf ...tar.bz2
packaged and compressed bz2
file decompression
You can also add the v
parameter to view the compression/decompression process after executing the above command
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。