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.
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
Short answer: yes, if you do not specify the --symlinks option. By default, the zip command will dereference symbolic links. This means that symbolic links are replaced by the actual files or folders they link to.
To remove a symbolic link, use either the rm or unlink command followed by the name of the symlink as an argument. When removing a symbolic link that points to a directory do not append a trailing slash to the symlink name.
Yes. They both take space as they both still have directory entries. A hardlink entry (really, a "normal entry" that [often] shares an inode) takes space, as does a symlink entry which must store the link path (the text itself) somehow.
Use the -s option to create a soft (symbolic) link. The -f option will force the command to overwrite a file that already exists. Source is the file or directory being linked to. Destination is the location to save the link – if this is left blank, the symlink is stored in the current working directory.
From the tar(1)
man page:
-h, --dereference follow symlinks; archive and dump the files they point to
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With