Amazon Prime Day August 2020

Linux Tar Archive commands


linux-tar-basic-cmds



Create Tar Archive:
tar -cvf shopping_29-1-2018.tar shopping

Tar Archive and compress with gzip:
tar -cvfz shopping_29-1-2018.tar.gz shopping

List Content of tar Archive File
tar -tvf uploadprogress.tar

Exclude Directories and Files
tar -czvf archive.tar.gz  tutorials --exclude=Downloads  --exclude=sample.txt

Add Files or Directories to tar Archive File
tar -rvf shopping-14-09-12.tar xyz.txt  (r - append)

Extract Tar Archive:
tar -xvf shopping_29-1-2018.tar 
or 
tar -xvf shopping_29-1-2018.tar.gz

Extract Tar Archive to specific directory:
tar -xvf shopping_29-1-2018.tar.gz -C /html

Untar Single file from tar File
tar -xvf shopping_29-1-2018.tar.gz basics.sh

Untar Single file from tar.gz File
tar -xvfz shopping_29-1-2018.tar.gz basics.sh

Untar Multiple files from tar, tar.gz and tar.bz2 File
tar -zxvf MyImages-14-09-12.tar.gz  "file 1" "file 2"

Tar Archive and compress with bz2:
tar -cvfj shopping_29-1-2018.tar.bz2 shopping

Extract Tar with bz2:
tar -xvf shopping_29-1-2018.tar.bz2 shopping


Tar Usage and 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.

Post a Comment

0 Comments