4.1 文件目录类
1.1、pwd指令
显示当前工作目录的绝对路径
1.2 ls
展示目录或是文件
-a展示文件或是目录,包括隐藏的。
1.3 cd
切换到指定的目录
1.4 mkdir
创建目录
-p创建多层目录
1.5 emdir
删除空目录
注意事项:
`rmdir`删除的是空目录,如果目录下有内容,无法删除。如果想要删除存在内容的目录可以使用`rm -rf`
1.6 touch
创建空文件
语法:
touch 文件名
案例:
- 创建单个文件
test.txt
[root@localhost test]# ll
总用量 0
[root@localhost test]# touch test.txt
[root@localhost test]# ls
test.txt
-
创建多个文件
touch test1.java test2.html test3.js
[root@localhost test]# touch test1.java test2.html test3.js
[root@localhost test]# ls
test1.java test2.html test3.js test.txt
1.7 cp
拷贝文件到指定的目录
基本语法:
cp [选项] source dest
* 常用选项
-r :递归复制整个文件夹
1.8 rm
删除文件或者目录
基本语法:
rm [选项] 要删除的文件或目录
* 常用选项
-r :递归删除整个文件夹
-f : 强制删除不提示
1.9 mv
移动文件与命令 或者重命名
基本语法
* mv oldNameFile newNameFile (功能描述:重命名)
* mv /temp/movefile /targetFolder (功能描述:移动文件)
2.0 cat
查看文件内容,是以只读方式打开
基本语法
cat [选项] 文件
* 常用选项
-n :显示行号