Linux and Networking

Linux and Networking

3.12 Other commands

3.12.1 Compress a file

To compress a file with gzip, you must use:

 

gzip compression_ratio file_to_compress

 

Example:

gzip CartaExtensa.txt

 

It will create a file called CartaExtensa.txt.gz that will contain the content of the CartaExtensa letter, but compressed.

If you now write:

 

gzip – 9 CartaExtensa.txt

 

It will create a file, with an even higher compression ratio, with the same more compressed information.

 

3.12.2 Compress a directory

This structure is generally used:

tar cvf[z] CompressedFile FILESANDFILES

 

c-create

v-verbose

f-file

z-zip (compressed)

x-extract

 

Example

tar cvfz TodoUsuario.tgz /home

 

You must indicate the extension to the compressed file and by typing the extension .tgz, to indicate that the gzip option was used.

 

You must indicate as .tgz, or .tar.gz:

TodoUsuario.tgz or TodoUsuario.tar.gz

 

The Demeter Project