To extract a zip file in a Linux or Unix-like system, you can use the unzip
command. To extract a zip file named myfile.zip
, you can use the following command:
unzip myfile.zip
This will extract all the files and directories contained in myfile.zip
to the current directory.
If you want to extract the zip file to a specific directory, you can use the -d
option followed by the name of the directory you want to extract the files to. For example:
unzip myfile.zip -d /home/user/documents
This will extract all the files and directories contained in myfile.zip
to the /home/user/documents
directory.
You can also use the -l
option to list the contents of the zip file without extracting it. For example:
unzip -l myfile.zip
This will display a list of all the files and directories contained in myfile.zip
, without extracting them.
If you want to extract only a specific file or directory from the zip file, you can use the -j
option followed by the name of the file or directory you want to extract. For example:
unzip myfile.zip file1.txt -d /home/user/documents
This will extract only the file file1.txt
from myfile.zip
to the /home/user/documents
directory.
You can also use the -v
option to display the names of the files and directories as they are extracted. This can be useful for seeing the progress of the extraction process. For example:
unzip -v myfile.zip
This will extract all the files and directories contained in myfile.zip
and display the names of the files and directories as they are extracted.