From ce53d4aaf544a48177f2356f65c3370ecf3cf2a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E7=A8=8B=E9=A3=8E?= Date: Fri, 28 Oct 2022 08:39:16 +0800 Subject: [PATCH] fix: fix the typo and add some examples (#439) * docs: update tar.md * docs: update tar.md --- command/tar.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/command/tar.md b/command/tar.md index e321304124e..d6ef556f327 100644 --- a/command/tar.md +++ b/command/tar.md @@ -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包内有哪些文件** :