To unzip a zip file in the Linux or Unix bash shell terminal, you can use the unzip
command.
The unzip
command is a utility for extracting files from a zip archive. It is available on most Linux and Unix systems by default.
To unzip a zip file using the unzip
command, follow these steps:
Open the terminal and navigate to the directory where the zip file is located.
Run the unzip
command followed by the name of the zip file. For example:
unzip myfile.zip
This will extract the contents of the zip file to the current directory.
By default, unzip
will extract all files and directories in the zip archive. If you want to extract only a specific file or directory, you can use the -j
option to specify the file or directory you want to extract.
For example, to extract only the file1.txt
file from the zip archive, you can use the following command:
unzip -j myfile.zip file1.txt
You can also use the -d
option to specify the directory where you want to extract the files.
For example, to extract the contents of the zip file to the /tmp
directory, you can use the following command:
unzip myfile.zip -d /tmp