[英]How to compress a symbolic link?
With tar, I tried to compress a repository in a chroot environment with ssh, but it failed as it just compressed the symbolic link itself.使用 tar,我尝试使用 ssh 在 chroot 环境中压缩存储库,但它失败了,因为它只是压缩了符号链接本身。
How can I compress its content?如何压缩其内容?
-bash-3.00$ ls -ail
1263583 lrwxrwxrwx 1 root root 18 Apr 18 2008 mainwebsite_html -> ../../var/www/html
-bash-3.00$ tar -cjvf archive.tar.bz2 mainwebsite_html
-bash-3.00$ ls -ail
7509101 -rw-r--r-- 1 user1 user1 136 Feb 22 08:57 archive.tar.bz2
1263583 lrwxrwxrwx 1 root root 18 Apr 18 2008 mainwebsite_html -> ../../var/www/html
From the tar(1)
man page:从tar(1)
手册页:
-h, --dereference follow symlinks; archive and dump the files they point to
Take care of placing the "h" option in the correct place.注意将“h”选项放在正确的位置。 In your example:在你的例子中:
tar -cjvf archive.tar.bz2 mainwebsite_html
should be应该
tar -chjvf archive.tar.bz2 mainwebsite_html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.