Unzip a file1/31/2024 ![]() You can list the contents of a zip file so that you can be assured of its contents before proceeding with decompression. Check the contents of the zip file without extracting So let's say I want to extract my files to the Downloads directory, then I will be using the following: unzip -d ~/Downloads/ Fedora-ISO.zip 4. If you notice, in all examples that I gave above, the unzip command will extract the files in the current working directory.Īnd you may not want that always so in case, you can specify the directory name using the -d flag: unzip -d /path/to/directory compressed_file.zip To append the decryption key, all you have to do is follow the given command syntax: unzip -P your-password compressed_file.zipįor example, here, I want to unzip a file named Fedora_protected.zip and my password is pass123: unzip -P pass123 Fedora_protected.zip 3. Try to avoid this method as the password you enter will remain in the command history and even executing, showing the sensitive password is not recommended! The syntax will remain the same as unzipping a normal file and later on, you are asked to enter the password: unzip compressed_file.zipįor example, here, I want to unzip a file named Fedora_protected.zip, so I will execute the following: unzip Fedora_protected.zipĪs you can see, after the command execution, it will ask for the passphrase and once you enter the correct one, you will have your file unzipped! Appending password key to command itself Entering password in command prompt without visibility (similar to entering a password for sudo).Appending password while executing command itself (not recommended).There are two ways to tackle this situation: Unzip a password-protected file in UbuntuĬreating a password-protected zip file in Linux is quite easy but what about decompressing it? Here I have used the tree command to list the contents of the directory and as you can see, the file has been unzipped successfully. To unzip the file, all you have to do is append the filename to the unzip command: unzip Compressed_fileįor example, here, I want to unzip a file named Fedora-ISO.zip, so I will be following the given command: unzip Fedora-ISO.zip Once you are done with the installation, you can refer to the given command syntax to use the unzip files: unzip Compressed_file Unzip it comes pre-installed in most Linux distributions.īut if you are running a minimal server, it will throw an error saying "Command 'unzip' not found":Īnd in that case, it can be installed using: sudo apt install unzip Let me discuss it in a bit more detail here. If the directory doesn't exist already, it will create it first and then extract the contents of the file.zip into it.Īctually, there is more to the unzip command. For that use: unzip -d directory_name file.zip You may want to unzip the file contents into its own folder. It will extract the contents of the zipped file in the current location. Extracting a zip file could seem like a challenge if you are stuck to the terminal but it is not really.Īll you have to do is to use the unzip command like this: unzip file.zip
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |