< All Topics
Print
Tar

x – instructs tar to extract the files from the zipped file
v – means verbose, or to list out the files it’s extracting
z – instructs tar to decompress the files – without this, you’d have a folder full of compressed files
f – tells tar the filename you want it to work on
c – creates a new archive

To list the contents of a .tar file before you extract
tar –tzf filename.tar.gz

tar xvf filename.tar 

tar xzvf filename.tar.gz

tar –xvzf somefile.tar.gz –C /home/user/destination

tar xjvf filename.tar.bz2

Unzip
  • -d /path/to/extact/location: Unzip an archive to a different directory.
  • -j: Unzip without creating new folders, if the zipped archive contains a folder structure.
  • -l: Lists the contents of an archive file without extracting it.
  • -n: Do not overwrite existing files; supply an alternative filename instead.
  • -o: Overwrite files, if relevant.
  • -P password: Supplies a password to unzip a protected archive file.
  • -q: Unzips without writing status messages to the standard output.
  • -t: Tests whether an archive file is valid.
  • -v: Displays detailed (verbose) information about the archive without extracting it.
  • -x filename: Extract the archive but do not extract the specified files.

unzip filename.zip

Zip/Tar/Gzip
gzip file
tar –cvzf namehere.tar.gz ~/Documents

tar –cvf namehere.tar ~/Documents

Previous rsync