Linux – How to Zip/Compress a Symlink compressionlinuxsymlink Is it possible and how can I zip a symlink from a linux shell? Best Answer You can store symlinks as symlinks (as opposed to a copy of the file/directory they point to) using the --symlinks parameter of the standard zip. Assuming foo is a directory containing symlinks: zip --symlinks -r foo.zip foo/ Rar equivalent: rar a -ol foo.rar foo/ tar stores them as is by default. tar czpvf foo.tgz foo/ Note that the symlink occupies almost no disk space by itself (just an inode). It's just a kind of pointer in the filesystem, as you probably know. Related SolutionsWindows – How to compress files in Windows in batch file I have very good experience using 7-Zip. It's open source and does an outstanding job of compression. Lots of formats and strong encryption if you need it. It has both GUI and command line versions. Linux Bash – How to Sort du -h Output by Size As of GNU coreutils 7.5 released in August 2009, sort allows a -h parameter, which allows numeric suffixes of the kind produced by du -h: du -hs * | sort -h If you are using a sort that does not support -h, you can install GNU Coreutils. E.g. on an older Mac OS X: brew install coreutils du -hs * | gsort -h From sort manual: -h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G) Related TopicLinux SCP – Can SCP Copy Directories Recursively?Linux – How to use GZip to create a .zip fileLinux – How to do a bind mount over a symlink
Best Answer
You can store symlinks as symlinks (as opposed to a copy of the file/directory they point to) using the
--symlinks
parameter of the standardzip
.Assuming
foo
is a directory containing symlinks:Rar equivalent:
tar
stores them as is by default.Note that the symlink occupies almost no disk space by itself (just an inode). It's just a kind of pointer in the filesystem, as you probably know.