Skip to content

Instantly share code, notes, and snippets.

@OctavioBR
Last active August 28, 2017 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OctavioBR/6cefa620d29891c045194227b7fec9fa to your computer and use it in GitHub Desktop.
Save OctavioBR/6cefa620d29891c045194227b7fec9fa to your computer and use it in GitHub Desktop.

TAR cheat sheet

TAR = Tape Archive but it is essentially the native linux format of creating an archive. Gzip = Compressed. Together a Gzipped Tar is the linux equivalent of a Zip.

To create a gzipped TAR archive of all files in the current directory do this:

tar -czvf archive.tgz *

to tar-gz the xfiles folder into xarchive.tgz do:

tar -czvf xarchive.tgz xfiles/

To extract the archive contents to the current directory do:

tar -xzvf archive.tgz

to extract to a specific existing dir do:

tar -xzvf archive.tgz -C /my/exisiting/path/

Options

c – create a archive file.
x – extract a archive file.
v – show the progress of archive file.
f – filename of archive file.
t – viewing content of archive file.
j – filter archive through bzip2.
z – filter archive through gzip.
r – append or update files or directories to existing archive file.
W – Verify a archive file.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment