【发布时间】:2015-10-25 11:55:04
【问题描述】:
我对使用 bunzip2 的 -c 标志有点困惑。
下面这行代码运行良好:
ls -l
-> -rw-r--r-- 1 root root 163 Oct 25 13:06 access_logs.tar.bz2
bunzip2 -c access_logs.tar.bz2 | tar -t
当我尝试在没有 -c 标志的情况下使用此代码时:
bunzip2 access_logs.tar.bz2 | tar -t
我收到消息:
tar: This does not look like a tar archive
tar: Exiting with failure status due to previous errors
但是当显示列表时ls -l:
-rw-r--r-- 1 root root 10240 Oct 25 13:06 access_logs.tar
文档说:
管道的左边是bunzip –c access_logs.tbz,它 解压缩文件,但(-c 选项)将输出发送到 屏幕。输出重定向到 tar –t。
根据手册:
-c --stdout
Compress or decompress to standard output.
似乎没有-c标志也能解压?
【问题讨论】:
-
如何解压一个 bzip2 压缩文本文件:bunzip2 file.bz2
-
如何解压任何 tar 档案,任何后缀 .gz、.xz、bz2 : tar xvf file.tar.*
-
»» tar:这看起来不像 tar 存档 «« >>> 要么不是 tar 存档,要么已损坏。
标签: linux compression bzip2