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

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

  •  
  •   VKMEPR · Dec 3, 2018 · 3923 views
    This topic created in 2742 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
        1
    al0ne  
       Dec 3, 2018
    直接把目录名字全部传过去不就可以了
    yangg
        2
    yangg  
       Dec 3, 2018
    xargs
    VKMEPR
        3
    VKMEPR  
    OP
       Dec 3, 2018
    已解决,原来有 --strip-components 参数可用。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2886 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 14:31 · PVG 22:31 · LAX 07:31 · JFK 10:31
    ♥ Do have faith in what you're doing.