New FAMILUG

The PyMiers

Showing posts with label xz. Show all posts
Showing posts with label xz. Show all posts

Saturday, 22 September 2012

Nén, giải nén bằng command line trong Linux

UPDATE: list files in an archive
UPDATE: extract all archive type

Dù dùng command line khá nhiều nhưng chuyển hẳn sang thì vẫn chưa thể làm ngay và luôn được.
Sau đây là những câu lệnh giúp nén / giải nén các định dạng zip, tar, tar.gz, tar.bz2, tar.xz bằng dòng lệnh:

1. zip
+ Nén:
zip file.zip file1 file2 file3
Ví dụ:
~/Huffman%zip Huffman.zip *

+ Nén cả thư mục:
zip -r directory.zip directory_name

+ Giải nén: (phải tạo thư mục bạn sẽ giải nén vào )
unzip -d thu_muc file.zip
Ví dụ:
~/Huffman%unzip -d Huffman Huffman.zip

+ Danh sách:
unzip -l file.zip

2. tar
+ Nén:
tar cvf file.tar file1 file2 file3
VD:
~/Linux%tar cvf hehe.tar a.txt b.mp3

+ Giải nén:
tar xvf file.tar

+ Danh sách:
tar tf file.tar