$ 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
我的命令有错吗?
答案1
喜欢 AmeyaVS 提示-
您需要为 tar 存档命名,而不是目录。tar 不会将.tar
/添加.tgz
到您的存档中。
tar (child): liunx adventure group/: Cannot open: Is a directory
说得很清楚。
提示:您可能不想使用-z
(gzip)来压缩。
-J
使用 xz,这是一种更现代的压缩。
答案2
请像这样运行该命令:
tar -czvf 'liunx adventure group'.tar.gzip liunx\ adventure\ group/
不要在压缩文件名中使用空格,因此上面的内容最好像这样:
tar -czvf liunx_adventure_group.tar.gzip liunx\ adventure\ group/
看man tar
:
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).
使用示例:
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/