How to unzip 7z file

If you’ve got a .7z file and need to unzip it using the Linux terminal, it’s straightforward.

First, let's understand what is a 7z File?

A 7z file is a compressed archive created by the 7-Zip software. It’s similar to ZIP files but often offers better compression, meaning it can shrink files more efficiently.

  1. Open Terminal: First, open your terminal.

  2. Install p7zip: The tool you need is called p7zip. If it’s not already installed, you can install it with the following command:

     sudo apt-get install p7zip-full
    

    This command works for Debian-based systems like Ubuntu. If you’re using a different Linux distribution, use the appropriate package manager.

  3. Navigate to the File’s Location: Use the cd command to go to the directory where your .7z file is located. For example:

     cd /path/to/your/file
    
  4. Unzip the File: To extract the contents of the .7z file, use the following command:

     7z x yourfile.7z
    

    Replace yourfile.7z with the name of your actual file.

  5. Check Extracted Files: After running the command, the files will be extracted to the current directory. You can list the files to confirm they’ve been extracted using:

     ls
    

And that’s it! You’ve successfully unzipped a .7z file using the Linux terminal.

3
Subscribe to my newsletter

Read articles from Ruchi Lamichhane directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ruchi Lamichhane
Ruchi Lamichhane

I am a tech ethusiast with passion for technology, embracing the world of continuous integration, automation, and collaboration to make a meaningful impact in the dynamic realm of DevOps.