18 Tar Command Examples – Unix/Linux

0
18201

In Unix- Linux , the name of the tar command is short for tape archiving, the storing of entire file systems onto magnetic tape, which is one use for the command. However, a more common use for tar is to simply combine a few files into a single file, for easy storage and distribution.

The tar command used to rip a collection of files and directories into highly compressed archive file commonly called tarball or tar, gzip and bzip in Unix – Linux. The tar is most widely used command to create compressed archive files and that can be moved easily from one disk to another disk or machine to machine.

4. Untar tar Archive File

To untar or extract a tar file, just issue following command using option x (extract). For example the below command will untar the file emrepic.tar in present working directory. If you want to untar in a different directory then use option as -C (specified directory).

root@cent ~]# tar -xvf emrepic.tar -C emre2
emre/
emre/emrepics1.jpg
emre/emrepics2.jpg
emre/emrepics3.jpg
emre/emrepics4.jpg
emre/emrepics5.jpg
Untar files in specified Directory ##
[root@cent ~]# tar -cvf emrepic.tar
emre/
emre/emrepics1.jpg
emre/emrepics2.jpg
emre/emrepics3.jpg
emre/emrepics4.jpg

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.