Show Menu
Cheatography

tar Cheat Sheet (DRAFT) by

tar

This is a draft cheat sheet. It is a work in progress and is not finished yet.

tar/tar.gz

Create archiv.tar with 1 file and all pdfs
tar -cf archiv.tar datei_­­1.txt *.pdf
Create archiv.tar with all subdir
tar -cf archiv.tar path/
Extract files
tar -xf archiv.tar
Add 1 specific file to archiv (uncon­pre­ssed)
tar -rf archiv.tar datei_­1.txt
Create archiv.tar.gz
tar -czf archiv.tar.gz file
Extract gzip archives
tar -xzf archiv.tar.gz -C /
Extract gzip archives to /path
tar -xzf archiv.tar.gz -C /path
Extract 1 specific file
tar -xzf archiv.tar.gz Path/file
Show which files are in archiv.tar
tar -tvf archiv.tar

tar.bz2

Create a tar.bz2 archiv
tar -cjf archiv.ta­r.bz2 test /*
Extract bz2 archiv
tar -xjf beispi­el.t­ar.bz2
Extract archiv to specific path
tar -xjf archiv.ta­r.bz2 -C /path
 

Zip/Unzip

Create Zip archiv
zip archiv.zip File1 example/*
Creating Zip with pw
zip -e archiv.zip File1 example/*
Extract file
unzip archiv.zip -d /path

rar

Createing a Rar archiv
rar a test.rar -p file1 file2
Creating a Rar achriiv and split the file into fragments
rar a -v2048 test.rar -p file1 file2
Creating a Rar archiv with pw
rar a -p archiv.rar
Extract from Rar archiv
unrar e (or with) /path/
Extract archiv according their folder structure
unrar -x
list files in archiv
unrar l
Update archiv with new file
rar u archiv.rar test.txt

gzip

Create a crompr­essed gzip
gzip FILE
Extract file from archiv
gzip -d FILE
Extract file keeps gzip file
gzip -d -k FILE
 

common tar Options

-c --create
create a new archive
-x
extract files from an archive
-j
filter the archive through bzip2
-z
filter the archive through gzip
-f
use archive file or device ARCHIVE
-u
only append files newer than copy in archive
--delete
delete from the archive
-r
append files to the end of an archive
-t
list the contents of an archive
--over­write
overwrite existing files when extracting

7z

Creating 7zip archiv
7z a archiv.7z file
Extract 7zip archiv
7z e archiv.7z
List files from 7zip archiv
7z l archiv.7z