Home / Hệ điều hành / Linux / Compression and Decompression in Ubuntu

Compression and Decompression in Ubuntu

Print Friendly, PDF & Email
This is a presentation of tar: Linux: File Compression and Archiving with gzip, zip, rar, tar, unzip…

Các file lưu trữ (đôi khi gọi là file nén) trên hệ thống UNIX/Linux (thường phần mở rộng là tar.gz hoặc .tgz) có thể được trích xuất (bung nén – extract) bằng một lệnh đơn giản.

Ví dụ: Để bung một file lưu trữ nén tên là target.tar.gz vào thư mục hiện hành, ta dùng lệnh:

gzip -dc target.tar.gz | tar xf – tar xvzf target.tar.gz

Nếu file được nén với chuẩn bzip2 (i.e., .tar.bz2), chúng ta có thể thay thế gzip bằng lệnh bzip2.

Nếu file nén với lệnh nén của UNIX (phần mở rộng là .z) thì chúng ta dùng lệnh sau:

zcat target.tar.Z | tar xf -

Nếu nén ở dạng *.tar.xz thì: tar Jxf *.tar.xz hoặc dùng unxz -z: để nén, và -d để giải nén. Hy vọng với tóm tắt này sẽ là nơi để tham khảo quý báu. Q. How do I extract tar.gz file under Linux / UNIX like operating systems? A. tar.gz is nothing but compressed tar archive. The tar program provides the ability to create tar archives, as well as various other kinds of manipulation. For example, you can use Tar on previously created archives to extract files, to store additional files, or to update or list files which were already stored. Initially, tar archives were used to store files conveniently on magnetic tape. The name “Tar” comes from this use; it stands for tape archiver. Despite the utility’s name, Tar can direct its output to available devices, files, or other programs (using pipes), it can even access remote devices or files (as archives).

Extract tr.gz. file

To extract one or more members from an archive, enter: tar -zxvf {file.tar.gz} If your tarball name is backup.tar.gz, enter the following at a shell prompt: tar -zxvf backup.tar.gz

Extracting an Entire Archive

To extract an entire archive, specify the archive file name only, with no individual file names as arguments. tar -zxvf backup.tar.gz tar xjvf cornbread.tar.bz2 Nếu chỉ là .bz2 thôi thì: bunzip2 spankythefish.bz2 Chuẩn nén 7z Cài đặt: sudo apt-get install p7zip Bung nén: p7zip -d filename.7z Chuẩn nén rar Dùng rar hoặc unrar Chuẩn nén zip zip và unzip.

tar [z|j]cvf
tar zcvf /mnt/tmp/blahblah.tgz /home/user
tar -cpzf /mnt/tmp/user.tgz /home/user

About Nguyen Vu Ngoc Tung

I love making new professional acquaintances. Don't hesitate to contact me via nguyenvungoctung@gmail.com if you want to talk about information technology, education, and research on complex networks analysis (i.e., metabolic networks analysis), data analysis, and applications of graph theory. Specialties: researching and proposing innovative business approaches to organizations, evaluating and consulting about usability engineering, training and employee development, web technologies, software architecture.

Leave a Reply

Your email address will not be published. Required fields are marked *




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