首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >tar命令错误"tar (子):liunx冒险组/:无法打开:是一个目录“

tar命令错误"tar (子):liunx冒险组/:无法打开:是一个目录“
EN

Ask Ubuntu用户
提问于 2018-12-20 07:43:45
回答 2查看 3K关注 0票数 -1
代码语言:javascript
复制
$ tar -czvf 'liunx adventure group'/ liunx\ adventure\ group/
tar (child): liunx adventure group/: Cannot open: Is a directory
tar (child): Error is not recoverable: exiting now
liunx adventure group/
liunx adventure group/datapacks/
liunx adventure group/advancements/
liunx adventure group/advancements/f10933e2-6368-4ffd-9d45-47f80e324ea1.json
liunx adventure group/session.lock
liunx adventure group/data/
liunx adventure group/data/map_1.dat
liunx adventure group/data/villages_nether.dat
liunx adventure group/data/villages_end.dat
liunx adventure group/data/idcounts.dat
liunx adventure group/data/scoreboard.dat
liunx adventure group/data/villages.dat
liunx adventure group/data/map_0.dat
liunx adventure group/region/
liunx adventure group/region/r.0.-1.mca
tar: liunx adventure group/: Wrote only 2048 of 10240 bytes
tar: Child returned status 2
tar: Error is not recoverable: exiting now

我的命令错了吗?

EN

回答 2

Ask Ubuntu用户

回答已采纳

发布于 2018-12-20 07:53:15

就像AmeyaVS提示 -

您需要给tar存档一个名称,而不是目录。tar不会将.tar/.tgz添加到您的存档中。

代码语言:javascript
复制
tar (child): liunx adventure group/: Cannot open: Is a directory

说得很清楚。

提示:您可能不想使用-z (gzip)进行压缩。-J使用xz,这是一种更现代的压缩。

票数 1
EN

Ask Ubuntu用户

发布于 2018-12-20 08:02:26

请按以下方式运行该命令:

代码语言:javascript
复制
tar -czvf 'liunx adventure group'.tar.gzip liunx\ adventure\ group/

不要在压缩的文件名中使用空间,所以上面的内容最好是这样:

代码语言:javascript
复制
tar -czvf liunx_adventure_group.tar.gzip liunx\ adventure\ group/

请参见man tar

代码语言:javascript
复制
Compression options
       -a, --auto-compress
              Use archive suffix to determine the compression program.

       -I, --use-compress-program=COMMAND
              Filter  data  through  COMMAND.   It must accept the -d option, for decompression.  The argument can contain
              command line options.

       -j, --bzip2
              Filter the archive through bzip2(1).

       -J, --xz
              Filter the archive through xz(1).

       --lzip Filter the archive through lzip(1).

       --lzma Filter the archive through lzma(1).

       --lzop Filter the archive through lzop(1).

       --no-auto-compress
              Do not use archive suffix to determine the compression program.

       -z, --gzip, --gunzip, --ungzip
              Filter the archive through gzip(1).

用法示例:

代码语言:javascript
复制
tar -czvf liunx_adventure_group.tar.gzip liunx\ adventure\ group/
tar -cjvf liunx_adventure_group.tar.bzip2 liunx\ adventure\ group/
tar -cJvf liunx_adventure_group.tar.xz liunx\ adventure\ group/
票数 1
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/1103290

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档