Tar Command (zip alternative)

Feb 25, 2024

This is another helpful command in our SysAdmin toolbox.

We can use tar as an alternative to the zip command in Linux.

tar -czvf compressed.tar.gz folder-to-compress/
  • -c: Create a new archive.
  • -z: Filter the archive through gzip for compression.
  • -v: Verbosely list files processed.
  • -f: Use the following filename for the archive.

This is very useful to create backups using SSH.

Extract

tar -xfv compressed.tar.gz
  • -x: extract
  • -v: Verbosely list files processed.
  • -f: filename

Graph View