How to compress and decompress using the Linux terminal

In the following article I will show you the main Linux commands for compress and decompress files in the different most used formats.

Surely some other user or follower of the blog, thinks that using the terminal having programs or ways to do it graphically or in an assisted manner, is a real delay, but as knowledge takes no place, And I like to know what I’m doing and check different ways of doing things, here are the main commands for compressing and decompressing files in Linux based on Debian.

gz files

To compress a file in gz format we will use the following command:

on file is the name of the file to compress

To decompress we will use this:


bz2 files

This compressed extension is only capable of compressing / decompressing loose files, so don’t try it with folders.

To compress we will use:

To unzip:

tar.gz files

To compress a file or directory to this extension we will use the following line:

  • tar -czfv file.tar.gz files

To unzip:

To view the contents of a tar.gz file:

The Linux terminal

tar.bz2 files

To compress this format we will use:

  • of -c files | bzip2> arxiu.tar.bz2

To unzip:

  • bzip2 -dc file.tar.bz2 | of the XV

To view content:

  • bzip2 -dc file.tar.bz2 | of -t

zip files

This is one of the most widespread formats in use, to compress a file to this extension from the terminal we will use the following command line:

To unzip:

To view content:

rare files

This is the most widespread and used otrpo format or extension, to compress a file or directory to this format we will use:

  • rar -a archivo.rar files

To unzip:

To view content:

or this:

As you can see it is not so difficult to use the terminal to do a few things from time to time, and so as we learn, we keep the gray matter in shape.

More information – Some useful keyboard shortcuts for Ubuntu

Related Posts

Next Post

Leave a Reply

Your email address will not be published. Required fields are marked *

You might also like

Welcome Back!

Login to your account below

Create New Account!

Fill the forms below to register

Retrieve your password

Please enter your username or email address to reset your password.