iT邦幫忙

0

BEST TAR COMMAND ( TAR ARCHIVE ) WITH EXAMPLES IN LINUX

Tar command is a very useful command utility stands for Tape Archive is also referred as Tarball is used to take backup of the data in archived format. It creates output file with extension .tar for example data.tar also called as Tar archive. Tar command is very simple to use and very convienent way to backup the data, It comes with so many features like take backup of data in archived format, compress the data by using gzip or bzip compression tools and so on.

Create a Tar Archive File using Tar Command

To create a tar archive file we can use tar command with option -c. Refer the below command.

[root@localhost ~]# tar -cvf file.txt.tar file.txt

Where :

c – create a tar archive file
v – for Verbose
f – for tar archive filename

To create a Tar archive of a directory follow the below command.

[root@localhost ~]# tar -cvf data.tar data/
/
data/
data/file3.txt
data/file2.txt
data/file4.txt
data/file1.txt
data/file5.txt

Extract a Tar Archive file using Tar Command

You can extract a tar archive file using tar command with option -x, Refer the command below.

[root@localhost ~]# tar -xvf data.tar
data/
data/file3.txt
data/file2.txt
data/file4.txt
data/file1.txt
data/file5.txt

Where :

x – Extract a Tar Archive

Read Full Post: http://www.elinuxbook.com/tar-command-tar-archive-with-examples-in-linux/


尚未有邦友留言

立即登入留言