I used to download and unzip files with a browser and file manager until I realized I could do it all from the terminal, without clicking or switching windows. I now use just six commands all the time. Here’s what they are and why they’re worth memorizing.

Start With Wget: My Default for Quick Downloads

The first command I ever used to download something from the command line wasWget. It’s built into most Linux distributions and super easy to use.

That’s it. The file gets saved in your current working directory. If you want to rename the file as it downloads, you can use the -O option:

Terminal showing wget successfully downloading a zip file from a remote server.

This is useful when the URL has a long or weird filename, and you want to keep things tidy.

Another option I often use is -q, which tells wget to run quietly. There will be no output unless there’s an error:

Linux terminal showing unzip testfile.zip extracting a video file, followed by an ls command listing the extracted MP4 file and original ZIP archive.

This is handy in scripts or when I don’t want the terminal cluttered with progress output.

When wget Fails, I Use cURL

In most cases, Wget gets the job done. But sometimes it doesn’t work, especially if the file is behind a redirect or the server expects different headers. That’s whenI switch to cURL.

The -L flag tells curl to follow redirects. The command might fail without it if the URL points to a redirect instead of the actual file. The -o flag just tells curl what to name the file once it’s downloaded.

Terminal showing a folder created after extracting a .tar.gz file.

I’ll be honest, cURL has a steep learning curve if you start digging into all its options. However, this command covers most use cases for simple file downloads.

Next, unzip to Extract .zip Files

After downloading, I almost always need to extract the contents. For ZIP files, the unzip command is straightforward.

This will extract everything into the current folder. If you want to keep things more organized, you’re able to extract to a specific directory:

Terminal output showing the use of tar -tf to preview the contents of the tar.gz file, displaying a list of files inside.

If the folder doesn’t exist, unzip will create it automatically.

Sometimes I run into issues where I already have some of the files, and I don’t want to overwrite them. In that case, I use:

The -n option means “never overwrite existing files.” On the flip side, if I’m doing something quick and just want to overwrite without being prompted, I’ll use:

Terminal showing folder contents after navigating into an extracted directory.

That saves me from answering “yes” or “no” a dozen times.

For tar Archives, I Memorized These tar Variations

ZIP files aren’t the only format you’ll see.On Linux, .tar.gz and .tar.bz2 are just as common, especially when you’re dealing with software packages, source code, or Linux backup archives.

And for bzip2-compressed files:

If I want to unpack the contents into a specific directory, I add the -C flag:

What I like about tar is that it lets you preview the contents of the archive before extracting anything:

That -t flag stands for “test” or “list,” so you may see what you’re dealing with before unpacking the whole thing.

I Always Peek Before Extracting

I like to list the contents before I extract anything, especially if I’m unsure what’s inside. For .zip files, that looks like:

And for .tar files, I use:

Sometimes an archive contains a single top-level folder, and sometimes a mess of files. Knowing what you’re about to extract helps avoid clutter.

Once I’ve unpacked something, I usually do a quick:

This is just to confirm that everything landed where I expected. Then I cd into the new folder:

Bonus: Combine Everything Into One Command

One of the best things about using the terminal is how easily you can chain commands together. For example, here’s how I download and unzip a file in one line:

Or using Curl:

I’ve set up a few functions in my .bashrc that let me reuse these commands with any URL. So now I can just run getzip [URL] or gettar [URL] without retyping the whole thing every time.

You’re on Your Way to Terminal Freedom

Learning to download and unzip files without leaving the terminal changed my work. It’s faster, keeps me focused, and works the same across every Linux system I use. Once you’ve done it a few times, it becomes muscle memory.

I highly recommend getting comfortable with these commands if you’re doing any kind of development, scripting, or systems work on Linux. You’ll save time, reduce clicks, and feel more in control of your system.