Commands.page Logo

How to Extract Zip Files in Ubuntu Using Terminal

This guide explains how to extract zip archives directly from the Ubuntu command line. You will learn the essential unzip command, how to install the necessary tools if they are missing, and how to specify destination folders for your extracted files without using a graphical interface.

Install the Unzip Utility

Most Ubuntu installations include the unzip tool by default. To verify if it is installed, open your terminal and run:

unzip -v

If you receive a command not found error, install the package using the Advanced Package Tool. First, update your package list, then install the utility:

sudo apt update
sudo apt install unzip

Extract a Zip Archive

Navigate to the directory containing your zip file using the cd command. Once located, execute the following command to extract the contents into the current folder:

 unzip filename.zip

Replace filename.zip with the actual name of your archive file. The terminal will display the progress as it inflates each file within the archive.

Extract to a Specific Directory

To extract files into a specific folder instead of the current directory, use the -d flag followed by the destination path. You can create a new directory simultaneously or use an existing one:

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

For example, to extract contents into a folder named documents, use:

unzip filename.zip -d documents

Verify the extraction was successful by listing the files in the target directory using the ls command.