1 CD Switch working directory
[Email protected] ~]# cd/usr/local/#切换到目录/usr/local
[Email protected] local]# CD. #切换到上一级目录
[Email protected] usr]# cd-#返回到/usr/local
/usr/local
2 Touch Create or modify a file
[email protected] ~]# Touch test.txt
In the current directory, if there is no test.txt, it is created directly; if it exists, it is the time to update the file
3 mkdir Creating a directory
[Email protected] ~]# mkdir game #创建目录game
[Email protected] ~]# mkdir-p/home/test/game #创建多级目录
[Email protected] ~]# mkdir test Gamek Hello #创建多个目录
4 PWD Displays the current path
[Email protected] test]# pwd
/home/test #返回当前工作目录
5 ls display directory and file information
[email protected] game]# ls #显示当前目录和文件的名称
[Email protected] game]# ls-a #显示包含的隐藏文件
[Email protected] game]# ls-l #显示文件和目录的详细信息
[Email protected] game]# LS-LH #显示容量信息
[Email protected] game]# Ls-ld/home #查看当前home目录自身的详细信息
[Email protected] game]# ls-lt #查看有时间排序的详细信息
[Email protected] game]# Ls-lu #显示最后到访时间
[Email protected] game]# LS-LC #显示属性变更的时间
6 MV Move or rename directories and files
[Email protected] ~]# mv Test.txt text.py #将text. PY renamed to Text.py
[Email protected] ~]# mv text.py/home/#将text. PY Move To/home
7 CP Copy files and directories
[Email protected] ~]# cp/etc/passwd/home/#复制passwd到/Home
[[email protected] ~]# cp/etc/passwd/home/pass #复制passwd到/home changed to pass
[Email protected] ~]# cp-r/home/logs/tmp/#复制子文件和目录到/tmp/
8 RM Delete
[Email protected] ~]# RM Test #删除test
[Email protected] ~]# RM-RF test #彻底删除且不提示
9 du displays the file and directory capacity
[[email protected] ~]# du-sh/home #查看/Home space occupied
Usage of all file systems in DF
[Email protected] ~]# df-a #查看分区及使用情况
[Email protected] ~]# df-i #查看分区iNode使用情况
[Email protected] ~]# df-h #带单位显示使用情况
Cat View File Contents
[[email protected] ~]# cat-b/home/passwd #显示行号, blank lines do not appear
[[email protected] ~]# cat-n/home/passwd #显示行号, including blank lines
Page more Paging view
[[email protected] ~]# More/tmp.log #分页查看, space to see next page, Q exit
Less paging view
[[email protected] ~]# Less/tmp.log #分页查看, space to see the next page, the arrow keys can page, q exit
The first 10 lines are displayed by default in the head view of the file
[Email protected] ~]# head-c 10k/tmp.log #查看前10k的内容
[Email protected] ~]# Head-20/tmp.log #查看前20行内容
Tail view file trailer default last 10 lines
[Email protected] ~]# tail-c 10k/tmp.log #查看尾部10k的内容
[Email protected] ~]# Tail-20/tmp.log #查看后20行
[Email protected] ~]# tail-f/tmp.log #动态查看
WC Statistic Line Information
[Email protected] ~]# wc-c/tmp.log #统计字节数
[Email protected] ~]# wc-l/tmp.log #统计行数
[Email protected] ~]# wc-w/tmp.log #统计单词数
This article is from the "Practical Linux knowledge and Skills sharing" blog, please be sure to keep this source http://superleedo.blog.51cto.com/12164670/1886035
Linux basic Commands-common command tools