Compress directory into tarball on Linux machine

From AcrodusWiki
Revision as of 09:45, 28 November 2024 by Alex (talk | contribs) (Created page with "This is the command, and more importantly the options for compressing a directory or folder into a tarball on linux. <pre> tar -czvf filename.tar.gz /path/to/directory </pre> Ensure that you create the tarball with touch first. Also to unzip use the command and options. <pre> tar -xvf /path/to/tarball </pre> -x : extract -v : give more info -f : filename you can also use the -C to specify output directory <pre> tar -xvf /path/to/tarball.tar/.gz -C /path/to/directo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This is the command, and more importantly the options for compressing a directory or folder into a tarball on linux.

tar -czvf filename.tar.gz /path/to/directory

Ensure that you create the tarball with touch first.

Also to unzip use the command and options.

tar -xvf /path/to/tarball

-x : extract -v : give more info -f : filename

you can also use the -C to specify output directory

tar -xvf /path/to/tarball.tar/.gz -C /path/to/directory