ruk·si

📦️ tar

Updated at 2016-04-08 08:58

tar commands are annoying. You will get by with knowing tar -vz - and using automcomplete.

tar -vz
# -v = verbose, so it will list processed files
# -z = use gzip (file.tar.gz)

tar -vz - (+TAB lists all possibilities)
# -A = Append (combine archives)
# -c = Create
# -d = Diff (compare)
# -r = Rewrite (add more files to archive)
# -t = Take a look (list)
# -x = eXtract
# -u = Update (update archived version if targeted is newer)

tar -vz -t - (TAB once again lists all possibilities)
# -f = specify a tar file
# list contents
tar -vz -t -f myarchive.tar.gz

# create a tar, includes the directory in the zip
tar -vz -c -f myarchive.tar.gz mydir/

# extract tar, extract to current directory
tar -vz -x -f myarchive.tar.gz

# extract tar, extract to another directory
mkdir otherdir
tar -vz -x -f myarchive.tar.gz -C otherdir/