226k views
4 votes
How to unzip file in linux command line

User Mkmurray
by
7.1k points

1 Answer

2 votes

Final answer:

To unzip a file in Linux command line, use the 'unzip' command. If 'unzip' is not installed, install it with your package manager. You can also specify a directory with -d, or use a password with -P.

Step-by-step explanation:

To unzip a file in Linux using the command line, you should use the 'unzip' command followed by the name of the .zip file you want to extract. Here's a simple example of how to unzip a file:

unzip filename.zip

If 'unzip' is not installed, you can typically install it using your distribution's package manager, for example:

sudo apt-get install unzip

on Debian-based systems like Ubuntu, or

sudo yum install unzip

on RedHat-based systems like Fedora.

Once installed, you can unzip a file to a specific directory using the -d option:

unzip filename.zip -d /path/to/directory

If the .zip file is password-protected, you can use the -P option followed by the password:

unzip -P password filename.zip

Remember to replace 'filename.zip' with the actual name of the file you want to extract, and '/path/to/directory' with the directory where you want to place the unzipped files.

User Guapo
by
7.7k points