Tar Commands Logo
All commands tested on Mac OS Monterey / Sep 12, 2023

Tar Commands for Developers

Tired of hunting through Stack Overflow posts for the correct
tar command for that thing you need to zip up?
Save yourself some time with this growing collection of
tar examples that you can copy and paste into your terminal.

Commands for creating tar archives

What do you need to add to your tar archive? Multiple directories? Everything except the hidden files? All but certain directories? Only specific filetypes?

Check out these tar commands to find out how to do it.

See the "create" tar commands

Commands for extracting from tar archives

You have a tar archive. Great. You can just extract it. But what if you only need to extract the image files? What if you only need a single file or all files of a specific filetype?

Check out these tar commands to find out more.

See the "extract" tar commands

Commands for appending to existing tar archives

You may have left something out of your original tar archive. Instead of recreating it, these command show you how to quickly append files and directories to your tar archives.

See the "append" tar commands

Commands for updating existing tar archives

Do you need to delete something from an existing tar archive without recreating the whole thing? Maybe a file, a directory, or all files of a specific filetype?

These tar commands should help you do that.

See the "update" tar commands

Commands for listing the contents of tar archives

You don't want to have to extract a tar archive just to know what's inside it. Disk space and all that.

These commands will help list the contents of a tar file so you know what's in there before you extract it.

See the "list" tar commands