• Image 1.png
    • 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
      • Image 3.png
    • wc统计一个文件行数,字数等信息,行数有点用 wc -l file
    • 以m为单位显示一个文件大小:du -hm file
    • 文件信息Image 2.png
    • Chmod:chmod u+ r 【给自己增加读权限】

    Image 10.png

    • Chmod : 数字表示

    Image 11.png

    • 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’
        • Image 1.png
      • grep:根据内容检索
        • grep “[内容]” 【目录】 -R
          • grep “hello” /opt/testshell/dir1/test.txt -Rn 【也可指定文件】
          • grep “hello” . -R 【当前目录下】
        • Image 2.pngImage 3.png
    • 压缩包管理
      • tar
        • cvf 仅仅归档不压缩
        • Image 1.pngImage 2.png
        • Image 3.png
      • rarImage 4.png
      • zipImage 6.png

    Image 1.png
    WC
    Image 2.png
    sort/uniq
    Image 3.png
    head
    Image 4.png