Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个 tar 包含:
/ # Root directory /level1/ # A sub directory /level1/a.file /level1/b.file /level1/... # The rest
我怎么能做这样的事情tar -xf会解压这样的内容level1/:
tar -xf
level1/
/a.file /b.file /... # The rest
只要它涉及像我原来的问题这样的简单子目录,我发现我可以这样做:
tar -xzf mytar.tgz --strip-components 1
tar xf mytar.tar mv /level1/* .