Skip to content

How to Unzip into a Specific folder in Linux

Covers
tar
On this page

Unzipping files is a common task in Linux. However, it can become a bit tricky when you need to unzip files into a specific folder. In this article, we will explore different methods to unzip files into a specific folder in Linux.

Method 1: Using the unzip command

The unzip command is a built-in utility in Linux that can be used to extract files from zip archives. To unzip a file into a specific folder, you can use the -d flag followed by the path to the target folder.

Here’s the command syntax:

For example, if you want to unzip a file called sample.zip into a folder called “unzipped” in your home directory, you can use the following command:

unzip ~/sample.zip -d ~/unzipped 

Method 2: Using the tar command

The tar command is another built-in utility in Linux that can be used to create and extract tar archives. To extract a tar archive into a specific folder, you can use the -C flag followed by the path to the target folder.

Here’s the command syntax:

For example, if you want to extract a file called sample.tar into a folder called “unzipped” in your home directory, you can use the following command:

tar -xvf ~/sample.tar -C ~/unzipped 

Method 3: Using GUI tools

If you prefer to use a graphical user interface (GUI), there are many file archiving and extraction tools available in Linux. One popular tool is the file roller, which is the default archive manager for many Linux distributions.

To extract a file using the file roller, you can simply right-click on the zip or tar archive and select “Extract Here” or “Extract to” to specify the target folder.

Conclusion

Unzipping files into a specific folder in Linux is a simple task once you know the right command syntax or have a GUI tool that supports this functionality. The methods discussed in this article should be enough to get you started. However, there are many other options and flags available for the unzip and tar commands that you can explore by reading their respective manuals.

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top