A Couple of Examples and Usage Cases for Dealing with Compressing and Uncompressing Files:
TAR – (Tape Archive)
Compressing / Creating / Uncompressing
Options:
c – create a new archive
v – be verbose
f – following is the name of the archive
z – filter using gzip
j – filter using bzip2
x – extract files from archive
r – add another file to an archive
Create a Tar archive-
tar cvf nameofarchive.tar [/path/to/dir/]
Create a Tar thats been gzipped-
tar cvfz nameofarchive.tar.gz [/path/to/dir/]
Create a Tar thats been bzipped-
tar cvfj nameofarchive.tar.bz2 [/path/to/dir/]
Extracting a Tar archive(untar)-
tar xvf nameofarchive.tar [/path/to/dir/]
Extracting a gzipped tar archive-
tar xvfz nameofarchive.tar.gz
Extracting a bzipped tar archive-
tar xvfj nameofarchive.tar.bz2
Add a file to a tar archive(Only works on non-compressed)-
tar rvf nameofarchive.tar [/path/to/new/file]
ZIP – (ZIP Archive)
zipping / unzipping
Create a zip archive-
zip nameofarchive [/path/to/file]
Create a zip of an entire directory-
zip -r nameofarchive [/path/to/dir/]
Extract all files from a zip(unzip)-
unzip nameofarchive.zip
RAR – (Roshal Archive)
RAR / UnRAR
Options:
a – create a rar archive
d – delete a file
r – recover a deleted file
u – update / add
a -p – Set password
l – lock
e – extract file from rar archive
x – extract but retain directory sturcture
l – list a files
t – test files in rar archive
Create a rar archive-
rar a nameofarchive.rar [/path/to/dir]
Extract all the contents of a rar-
unrar e nameofarchive.rar
Extract to a specific directory-
unrar e nameofarchive.rar [/path/to/extract/to/]
Set a password on a rar archive-
rar a -p nameofarchive.rar