How to Install and Use Unzip on Ubuntu 24.04

Unzipping files on Linux systems, including Ubuntu 24.04 is a straightforward process that allows you to extract the contents of compressed zip archives. You can perform the content extraction process from a zip file on your Ubuntu system by installing the unzip utility. The unzip is a power command line tool that allows you to decompress and access the contents of the zip file on your system directly from the terminal. It has several additional options that can also be used to change the way of unzipping the files on your system.

Read this tutorial for a detailed guide on:

How to Install Unzip on Ubuntu 24.04

The unzip utility is pre-installed in most Linux systems, including Ubuntu 24.04. However, if you have accidentally deleted the unzip utility, install it again from the Ubuntu standard repository using the following command:

sudo apt install unzip -y
Unzip On Ubuntu 24.04 A

Once you complete the unzip installation, confirm the version using the following command:

unzip -v
Unzip On Ubuntu 24.04 B

How to Use Unzip on Ubuntu 24.04

Unzipping a file on Ubuntu is pretty simple once you manage to install the unzip utility from the above-provided apt command. The following syntax will be used when you unzip a zip file on Ubuntu:

unzip file_name.zip

You must replace the file_name.zip with the zip file name you have downloaded on your system. 

Here, we have unzipped the zip file named master.zip on Ubuntu using the following command:

unzip master.zip
Unzip On Ubuntu 24.04 C

You can also view the content of the zip file by using the unzip command with the -l flag:

unzip -l master.zip
Unzip On Ubuntu 24.04 D

By default, the unzip command extracts the files to the current location. However, you can change the default location by adding the -d option with the unzip command, followed by the zip filename and new location. 

The syntax to use the unzip command to extract the file at a different location is provided below:

unzip -d file_name.zip /path/to/new_location

Here, the following command extracts the master.zip file to the Downloads location: 

unzip master.zip -d /home/ilf/Downloads
Unzip On Ubuntu 24.04 E

If you want to exclude a specific file from the zip file and extract other contents, you can use the -x flag followed by the file name you want to exclude. The syntax is provided below:

unzip filename.zip -x filename_to_exclude

Let’s unzip the content of the zip file master.zip and skip README.md using the following command:

unzip master.zip -x README.md
Unzip On Ubuntu 24.04 F

If the content of the file is already present at the current location, you can overwrite the files with the unzip command using the -o flag:

unzip -o filename.zip

Here, let’s unzip the content of the master.zip file and overwrite the files in case they are present at the current location:

unzip -o master.zip
Unzip On Ubuntu 24.04 G

There are some additional flags you can use with the unzip command on Ubuntu, they are given in the table provided below:

OptionsDescription Example
-nNever overwrites the existing files. The extraction process will skip the file if a filename with the same name already exists. unzip -n master.zip
-PSpecifies a password for a password-encrypted file. You can use this option if a zip file is password protectedunzip -P write-password master.zip
-jDiscards the directory structure and extracts all files directly into the current directory.unzip -j master.zip
-vEnable verbose output, which means providing additional information during extraction.unzip -v master.zip
-qEnable quiet mode, suppresses the normal output, and makes the extraction process less verbose.unzip -q master.zip
-uUpdate the existing files if there exist files with the same name.unzip -u master.zip

These are the options that can be used to change the behavior of the unzip command on Ubuntu 24.04.

Note: You can also unzip a zip file on Ubuntu from GUI by right-clicking on the file and choosing either Extract or Extract to.. option. The Extract option will simply extract the zip file content to the current location. For Extract to.., you can pick the location according to your choice.

Unzip On Ubuntu 24.04 H

Conclusion

The unzip command is widely used for extracting the content of the zip file on Linux systems, including Ubuntu 24.04. It is preinstalled on most systems, and if deleted, you can install them from the “sudo apt install unzip” command. After unzip installation, use the command without an argument to unzip the content of the zip file on your Ubuntu system. Apart from that, you can use flags like -l,-d,-n, -o, and others to change the behavior of the unzip command. 

We have described the working of the different flags that can be used with the unzip command. Use them according to your needs and start extracting files on your system.

var authorName = "' . esc_js($post_author) . '";'; ?>