Tuesday, July 10, 2007

unzip zip untar tar bzip2 bunzip2 gzip gunzip files in linux howto

Well, I receievd an email which fairly ask me about zipping in linux. Here are simple ways to package, compress and uncompressed files in linux. For simplicity, only the basic parameters were used from the sample issued commands.

Let us change folder first and go to /tmp temporary and create 3 zero-sized files.

# cd /tmp
# touch file1 file2 file3

Now, do our thing

# zip zipped.zip *
# ls -la
# unzip zipped.zip
# rm -rf *.zip

# tar zcvf tarred.tgz *
# ls -la
# tar zxvf tarred.tgz
# rm -rf *.tgz

# bzip2 *
# ls -la
# bunzip *
# rm -rf *.bz

# gzip *
# ls -la
# gunzip *
# rm -rf *.bz

Most of them would accept CLI parameters. Appending --recursion or -r or -R would try to traverse the directory structure recursively.



Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy