
- cd ~ : 回到工作目录或家目录,root用户和普通用户是不一样的,root用户cd ~进入/root,普通用户cd ~进入/home/user
- cd - : 返回从刚刚来的目录a->b,在b下面cd - 就回到了a
- 同级创建3个目录:mkdir aa bb cc 创建层级目录要加-p:mkdir -p aa/bb/cc
- 读文件
- 一屏一屏读:less file
- 自己确定读前几行:head -5 file1
- 自己确定读后几行:tail -5 file1
- 链接
- 符号链接 ln -s a(符号链接名) b(文件)
- 硬链接 ln a b

- wc统计一个文件行数,字数等信息,行数有点用 wc -l file
- 以m为单位显示一个文件大小:du -hm file
- 文件信息

- Chmod:chmod u+ r 【给自己增加读权限】

- Chmod : 数字表示

- Chown : 修改文件的所有者/所有组
- chown root:root file 先用户:后组
- 所有者不需要在所有组里面,比如chown testuser:root file , testuser不在root组里面,但还是可以操作。
- chown只能root用户操作,操作前,用户和组必需存在
- chown root:root dir -R 把dir文件夹下面的文件也修改
- 查找
- find:根据文件名特征查找文件
- find 【目录】-name ‘[文件]’
- find /opt/testshell/ -name ‘*.txt’
- find . -name ‘*.txt’

- find 【目录】-name ‘[文件]’
- grep:根据内容检索
- grep “[内容]” 【目录】 -R
- grep “hello” /opt/testshell/dir1/test.txt -Rn 【也可指定文件】
- grep “hello” . -R 【当前目录下】


- grep “[内容]” 【目录】 -R
- find:根据文件名特征查找文件
- 压缩包管理
- tar
- cvf 仅仅归档不压缩



- rar

- zip

- tar

WC
sort/uniq
head
