ENCS Home Administration Alumni Departments Research News & Events Jobs
Search Service Desk:
Advanced
Quick links
Contact the Service Desk


Faculty, Staff, Students
Room: EV007.182
Phone ext.: 5713

Students, Staff
Room: H0964-00
Phone ext.: 4181


servicedesk@encs.concordia.ca

Service Desk

FAQ Index
 
Unix/Linux
Unix/Linux
How to archive/compress files in Unix?
Login

[Modified Tuesday, Dec 31st 2002 by Ana Rita Cabo]


To create a single file (archive) from various files, use tar

tar cf archive.tar file1 file2 (...)

Where archive.tar is the archive contaning file1, file2 (...)

To extract various files from an archive tar file, use tar

tar xf archive.tar

Note: tar does not compress!

To compress/decompress only one file, use gzip

gzip file_name
gunzip file_name.gz

Often tar and gz are used together to obtain a compressed archive

tar cf archive.tar file_name1 file_name2
gzip archive.tar

this will produce a archive.tar.gz file
To decompress use,

gunzip file_name.gz
tar xf archive.tar

Luckily, these steps can be done in one single step by using the
z argument.

To compress,

tar cfz archive.tar file_name1 file_name

To decompress

tar xfz archive.tar

Alternatively, one can also use zip to compress various files

zip file_name.zip file_name1 file_name2

To decompress a file having various files in it using zip

unzip file_name.zip


 
If you have any comments about the website please Contact us

Copyright © 2005 Faculty of Engineering & Computer Science