Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix the typo and add some examples #439

Merged
merged 2 commits into from
Oct 28, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
docs: update tar.md
  • Loading branch information
Makonike authored Oct 27, 2022
commit 0e57bc2e157b311a64616ef0657f69c43dd39b08
9 changes: 8 additions & 1 deletion command/tar.md
Original file line number Diff line number Diff line change
Expand Up @@ -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包内有哪些文件** :
Expand Down