14 สิงหาคม, 2553

How do you make a .zip archive in the command line?

ติดตั้ง package
$sudo apt-get install zip

ดูรายละเอียดของคำสั่ง zip
$ man zip

ดูการใช้งานของคำสั่ง zip
$ zip --help

cd เข้าไปยัง directory ที่ต้องการ zip file
$ cd /path/to/directory/

คำสั่ง zip (ตัวอย่าง)
$ zip filename.zip file1.txt file2.doc
# จะได้ filename.zip โดยภายในจะมี file1.txt และ file2.doc

$ zip -r filename.zip folder1/ folder2/ ...
# จะได้ filename.zip โดยภายในจะมี folder1 folder2
# การ zip จาก folder ต้องเพิ่ม option -r เพื่อให้มีผลกับ subdirectory ภายใต้ folder1 folder2 ด้วย

คำสั่ง upzip
$ unzip filename.zip
#แตกไฟล์ทั้งหมดออกมาวางใน path ปัจจุบัน

$ unzip filename.zip -d directoryname
#แตกไฟล์ทั้งหมดวางใน directory ชื่อ directoryname


เพิ่มเติม (.zip)
http://info.eps.surrey.ac.uk/FAQ/zip.html
http://lowfatlinux.com/linux-zip-manual.html

เพิ่มเติม (.rar)
http://tips.webdesign10.com/how-to-open-a-rar-file-in-linux

ไม่มีความคิดเห็น:

แสดงความคิดเห็น