fix: fix the typo and add some examples (#439)

* docs: update tar.md

* docs: update tar.md
This commit is contained in:
吕程风 2022-10-28 08:39:16 +08:00 committed by GitHub
parent dc05a4ebab
commit ce53d4aaf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -469,10 +469,17 @@ tar -jcvf log.tar.bz2 log2012.log 打包后,以 bzip2 压缩
**解压目录**
去掉第一层目录结构,要出除第二层,--strip-components 2
参数--strip-components NUMBER在提取时从文件名中删除NUMBER个前导组件如要去除前二层参数为--strip-components 2
```shell
tar -xvf portal-web-v2.0.0.tar --strip-components 1 -C 指定目录
示例
tar -xvf xxx.tar.gz -C /usr/src/a
/usr/src/a/xxxxx/src/opp/b.txt
tar -xvf xxx.tar.gz -strip-components=1 -C /usr/src/a
/usr/src/a/src/opp/b.txt
```
**查阅上述tar包内有哪些文件**