method to compress file in linux

How To View The Content of Compressed Files On Linux

There are lots of compression tools available in Linux and you just need to install them according to your needs. you can install tar and zip command when not found. You can also use this for file compression in Linux and see how to view the content compress the file.

Compression toolFile ExtensionDecompression tool
bzip2.bz2bunzip2
Gzip.gzgunzip
Zip.zipunzip

 

Check Out: Configure Varnish For Apache Web Server On CentOS 7

Tar Commands

I have created a folder and a few files which I moved into the folders. I compressed this folder with a .tar extension.

how to view the content

If you want to see the content of this compressed file, just use the below commands

tar -tvf touch.tar

tar command install

In a similar way, you can use for all extensions like tgz, tar.gz.

Check Out: How To Install Winscp Open source Software In Ubuntu 18.04

Zip Commands

I will create the Zip file folder to compress it using zip -r touch.zip touch and simply use unzip to extract.

file compression in linux

You can view the content using zip -sf touch.zip

zip command not found

If 7z command not found, you need to install the package p7zip. You can find this in epel-release packages.

Check Out: How To Install Docker Compose Command In Docker Linux

7z touch.7z touch

Bzip2 and Bunzip2 Command

You can also use bzip2 compression tool for files.

bzip2 file

how to compress file

To expand the files use bunzip2 file.bz2

Check Out: How To Restore Server Using AMI On Amazon Cloud

Gzip and Gunzip Commands

In a similar way, there is another command for files compression use gzip file and to expand the files use gunzip file.gz. you can also use the “d option to decompress the files.

You’re done. tar command install file compression in linux zip command not found how to compress

Leave a Reply

avatar
  Subscribe  
Notify of