Header Ads Widget

Nén và giải nén

Thao tác nén file và giải nén trên Server

Zip và zipsplit

Nén thư mục JAVA
zip -r JAVA.zip JAVA
Zipsplit: Chia nhỏ file nén
zipsplit -b /ten_thu_muc_chua_file_chia_nho -n 197000 /thu_muc_chua_file_nen/ten_file
  • ten_thu_muc_chua_file_chia_nho : là tên thư mục chứa file nén /home/user/
  • 197000: là dung lượng mỗi file muốn chia 197000 = 197kb
  • thu_muc_chua_file_nen: là thư mục lưu trữ file nén
  • ten_file: tên file nén
Nối các file
cat thu_muc_chua_file_chia_nho/* > thu_muc_chua_file_chia_nho/backup.zip

Tgz, Tar

Nén file hoặc thư mục
tar -xvzf file_name.tgz /home/user
  • c – Tạo file .tar mới
  • v – Hiển thị quá trình nén lên màn hình
  • f – Tên file
  • z- sử dụng gzip để nén
Giải nén
tar -xvf backup.tgz -C /home/test/

Giải nén tar.gz 

tar -xf archive.tar.gz

Giải nén Gz
gzip -d file.gz

Nhận xét