鼎鼎知识库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2021.4.24熟悉tar命令.md 542B

3 vuotta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. > 创建档案
  2. ```
  3. 查看当前目录:pwd (/root/tmp)
  4. 创建目录:mkdir a
  5. 创建文件:touch a/1.txt touch a/2.txt
  6. 创建档案:tar cvf archive01.tar a/
  7. ```
  8. 创建压缩档案
  9. ```
  10. tar cvzf archive02.tar.gz a/
  11. ```
  12. > 解压档案
  13. 解压所有
  14. ```
  15. tar xvfz archive02.tar.gz
  16. ```
  17. 解压所有到某个目录
  18. ```
  19. tar -xzf archive02.tar.gz -C b/
  20. ```
  21. 解压某个文件
  22. ```
  23. tar xvfz archive02.tar.gz a/1.txt
  24. ```
  25. 解压某个目录
  26. ```
  27. tar xvfz archive02.tar.gz a
  28. ```
  29. > 浏览压缩档案
  30. ```
  31. tar tvfz archive02.tar.gz
  32. ```