LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Compression (https://www.linuxquestions.org/questions/linux-newbie-8/compression-4175486458/)

CJennings87 12-01-2013 11:52 AM

Compression
 
I need some help figuring out my mistakes. I know I am close, but I am getting confused. Any help is much appreciated :)

Compress the symbolic link /root/sfile using the compress utility and display the compression ratio4

# bzip2 –v /root/sfile unsure because it is a symbolic link


Compress the contents of the directory /root/dir1 using the gzip utility and display the compression ratio

# gzip –v /root/dir1 unsure because it is a directory (-r for directory, but -v to show compression ratios)


Decompress the file /root/letter.bz2

# uncompress –v /root/letter.bz2

smallpond 12-01-2013 12:58 PM

You get an error if you try to compress a symlink, so you need to get to the real file:

Code:

REALFILE=$(readlink /root/sfile)
bzip2 -v $REALFILE

You can have multiple options on a command:

Code:

gzip -r -v /root/dir1

CJennings87 12-02-2013 04:38 PM

Thank you! :)


All times are GMT -5. The time now is 10:35 AM.