-
管理文件权限
-
1 、复制/移动/删除 文件 cp/mv/rm [options] sourceDir
1、options
-f 强制
-r 目录递归
-l 交互
2、举例
cp hello.txt / user/root 将hello.txt文件复制到/user/root目录下
mv hello.txt / user/root 将hello.txt文件剪切到/user/root目录下
rm hello.txt 删除hello.txt
touch hello.txt 创建hello.txt文件
mkdir test //创建test文件夹
方式一
>hello.txt 将hello.txt文件的内容全部删除
方式二
echo -n >hello.txt 将hello.txt文件的内容全部删除
ln -s 链接文件 源文件
find / -name hello.txt 查找hello.txt文件所在路径
i:在光标前
I:在当前行首
a:光标后
A:在当前行尾
o:在当前行后插入一新行开始编辑
O:在当前行前插入一新行开始编辑
x或dd:删除光标处 一个字符及删除该行
/pattern 从光标开始处向文件尾搜索pattern
?pattern 从光标开始处向文件首搜索pattern
cat
tail
head
more
方式一 tar
-c 建立打包档
-t 查看打包档案里含有的文件名
-x 解打包或解压缩的功能
-j bzip2进行压缩
-z gzip进行压缩
-v 将压缩、解压缩过程中处理的文件名输出到屏幕
-f 接file_name 告知要处理的文档
-C 后面接要解压缩的特定目录
-p 保留档案的原本权限和属性,主要是备份重要文件的时候使用
-P 是否保留根目录/,一般不用
8.1.1 压缩文件
tar zvxf hello.tar hello.txt
8.1.2 解压问
tar -zvxf hello.tar
方式二 zip
fuser hello.txt 查看
fuser -k hello.txt 删除