Linux Commands List – Archiving & Compression

RedhatThe following command will be used when you are taking the backup of data. Compressing the file to minimal size to transfer to another location. There are 3 types of compression utlities in linux basically ie .gz,.bz2 and .zip files.


Archiving & Compression



# bunzip2 filename.bz2

Uncompressing “filename.bz2 to filename”

# bzip2 filename

compress a “filename to filename.bz2”

# gunzip filename.gz

Uncompressing “filename.gz to filename”

# gzip filename

compress a “filename to filename.gz”

# tar -cvf backup.tar filename

Create tarball in name of “backup.tar”

# tar -cvf backup.tar file1 file2

create tarball from ‘file1’, ‘file2’

# tar -tvf backup.tar

To view the content of tarball

# tar -xvf backup.tar

extract a tarball

# tar -xvf backup.tar -C /location

extract a tarball into location where u want

# tar -jcvf backup.tar.bz2 file1

create a tarball with bz2 compression

# tar -jxvf backup.tar.bz2

Uncompress the bz2 file

# tar -tvf backup.tar.bz2

To view the content of tarball bz2

# tar -zcvf archive.tar.gz dir1

create a tarball with gz compression

# tar -zxvf archive.tar.gz

Uncompress the gz file

# tar -tvf backup.tar.gz

To view the content of tarball gz

# unzip

decompress a zip archive

# zip file

create an compressed in zip



Share This Post