Skip to content

Basic usage of tar command to (de)compress gz/bz2/xz files


tar is a popular command-line tool used for archiving files. It is commonly used for creating backups, compressing files, and transferring files between different systems. Tar can create a single archive file that contains many files and directories, making it easy to move and manage large amounts of data.

Supported compression formats:

  • gzip (.gz)
  • bzip2 (.bz2)
  • xz (.xz)


# compress
tar zcf FILE.tar.gz FILEDIR
# decompress
tar zxf FILE.tar.gz


# compress
tar jcf FILE.tar.bz2 FILEDIR
# decompress
tar jxf FILE.tar.bz2


# compress
tar Jcf FILE.tar.xz FILEDIR
# decompress
tar Jxf FILE.tar.xz
Leave your message