How to unzip files from terminal on Linux

How to unzip files from terminal on Linux

Unzip the file from Linux terminal

Compressed files can be easily transferred and used on computer systems. File compression in Linux is one of the easiest utilities. The zip command makes it easy to compress files without losing quality. If you unzip this file, you can use unzip Linux utilities.

Installation of decompression utility

Can be installed unzip Utilities in the following ways:

Unzip with CentOS

sudo yum install unzip

Install Unzip on Ubuntu or Debian

sudo apt install unzip

Unzip with Fedora

sudo dnf install unzip

Unzip with SUSE / OpenSUSE

sudo zypper install unzip

How to unzip files in current directory

The following is the easiest and easiest way to unzip a .zip file on Linux without any options, but keep in mind that you need write permission to the current directory.

unzip demofile.zip

The above command will be decompressed demofile.zip Save the files in the current directory and the extracted files

How to unzip files in a specific directory

You can extract files to a specific directory using: -d Options using the unzip command. Since you always need write permission for a particular directory, we recommend running with the following command: sudo.

For example, the following linux4one.com.zip Files are extracted internally /var/www/html/ directory:

sudo unzip linux4one.com.zip -d /var/www/html/

How to extract files with password

You can also use the unzip command to extract password-protected compressed files. The following is the basic syntax for uncompressing password protected files.

sudo unzip -P PASSWORD file.zip

For example, to unzip demofile.zip with a password abc123 Then you can do this using the following command:

sudo unzip -P abc123 demofile.zip

Check the contents of the Zip file without decompressing

You can review or list the contents of all zip files using: -l Options using the unzip command.

For example, to list all the content of demofile.zip Execute the following command:

unzip -l demofile.zip

Conclusion

You learned how to unzip files on Linux from the terminal. If you have any questions, don’t forget to comment them out.

Sidebar