Distributions
› Ubuntu
› Fedora
› CentOS
中文资源站
› 网易开源镜像站
VKMEPR
V2EX  ›  Linux

tar 如何解压指定目录下的全部文件?

  •  
  •   VKMEPR · Dec 3, 2018 · 4222 views
    This topic created in 2900 days ago, the information mentioned may be changed or developed.

    假设 abc.tar.gz 里有多个目录,需要解压其中一个目录下的全部文件。

    如下尝试无效,解压整个目录出来,而不是只解压目录下的文件。

    tar -xvf abc.tar.gz 目录名 /*
    3 replies  •  2018-12-03 17:09:45 +08:00
    al0ne
    al0ne
    Dec 3, 2018
    1
    直接把目录名字全部传过去不就可以了
    yangg
    yangg
    Dec 3, 2018
    2
    xargs
    VKMEPR
    VKMEPR
    OP
    Dec 3, 2018
    3
    已解决,原来有 --strip-components 参数可用。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3435 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 05:36 · PVG 13:36 · LAX 21:36 · JFK 00:36
    ♥ Do have faith in what you're doing.