Compression

refer:

.gz

Compress and decompress single file:

$ gzip myfile
$ gzip -d myfile.gz

Recursive compress and decompress all files in a folder

$ gzip -r myfolder/
$ gzip -dr myfolder/

.bz2

Only can compress single file.

Compression: bzip2 <target-file>

Decompression: bzip2 -d <archive.bz2>

.tar

壓缩:tar cvf FileName.tar DirName

解壓:tar xvf FileName.tar

.tar.gz

壓缩:tar czvf FileName.tar.gz DirName

解壓:tar xzvf FileName.tar.gz

.zip

compression via zip command:

Option notes
-r recursively
-m Delete the originals
Move the specified files into the zip archive;
-P pass Set up a password
$ apt-get install zip
$ zip myfiles.zip file1 file2
$ zip -r myfiles.zip myfolder/
$ zip -r -m myfiles.zip myfolder/
$ zip -r -P mypassword myfiles.zip myfolder/

decompress a zip file vi unzip command

$ unzip myfiles.zip

results matching ""

    No results matching ""