Ví dụ cơ bản về lệnh tar trong linux

Làm việc với linux,chúng ta thường xuyên phải sử dụng lệnh tar.Trong bài viết này chúng ta sẽ xem lại các option cơ bản của nó cùng với các ví dụ cụ thể nhé.

tar (tape archive) is a tool used to collect multiple files into a single file - This file is called the archive.

Syntax cin bAsiann cannealinga tar

tar option(s) archive_name file_name(s)

1)Create and unpack .tar file

a) Apple (Create) file *.tar

tar cvf archive_name.tar dirname/

b) Fella (Extract) file *.tar

To extract the .tar we replace c by x nhé

$ tar xvf archive_name.tar
Inside :

C : Create 1 file archive

X : Fella (Extract) file

V:Show list of files in progress

F : tên file archive

2)Create and decompress files .tar.gfrom

a) Apple (Create) file *.tar.gz

To create 1 file archive nén(gzip) we add arguments from

tar –cvfz archive_name.tar dirname/

b) Decompression (Extract) file *.tar.gfrom

$ tar xvfz archive_name.tar.gz
Inside :
FROM : create archive files using gzip program

You note .tar.gz and .tgz archive file is a.

3)Create and unpack .tar file.bz2

a) Apple (Create) file *.tar.bz2

To create 1 file archive nén(bzipped ) we add arguments j

tar -cvfj archive_name.tar dirname/

b) Decompression (Extract) file *.tar.bz2

$ tar xvfj archive_name.tar.gz
Inside :
J : create archive file with the program bzip2

The archive file you note .tbz and TB2 is a

** gzip and gzip2: bzip2 takes longer to compress and decompress than files created by gzip2 gzip.Nhung lighter than gzip

Through these examples hopefully you will easily remember more of the options for the tar command.

Chúc các bạn thành công

We can not translate from Uighur to Vietnamese.
VN:F [1.9.22_1171]
Rating: 4.0/5 (2 votes cast)

Ví dụ cơ bản về lệnh tar trong linux, 4.0 out of 5 based on 2 ratings