Zipping a directory in Linux terminal

by Vivek Gite on October 31, 2007 · 8 comments

Q. How do I zip files in Linux so that I cam email them to my friend? How do I zip files on server at shell prompt?

A. zip is a compression and file packaging utility for Unix, Linux, VMS, MSDOS, OS/2, Windows NT, Minix, Atari and Macintosh, Amiga and Acorn RISC OS etc. This utility is installed by default on most Linux computers. he program is useful for packaging a set of files for distribution; for archiving files; and for saving disk space by temporarily compressing unused files or directories.

To zip directory called pics in your home directory (/home/you/pics), type the following command:
$ zip -r myvacationpics.zip /home/you/pics/

It recurse into directories (all files and directories inside pics) to produced zip file called myvacationpics.zip.

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 8 comments… read them below or add one }

1 bryan January 9, 2009

I forgot how to do this. First result on google, exactly what I needed. Thanks.

Reply

2 Luuk January 16, 2009

Same for me, very useful! Also simple things can be forgotten. Thank you!

Reply

3 Dhawal June 10, 2009

Thanks….This is what i was looking for.

Reply

4 Vishwajeet Singh February 13, 2010

It helped me as well thanks :)

Reply

5 Bojan Sukalo May 6, 2010

It’s good to be reminded!

Thank You!

Reply

6 Sunil January 28, 2011

Thanks a ton.

Reply

7 bob June 20, 2011

lol just do right click compress

Reply

8 Ahmad Fikrizaman January 23, 2012

thanks.. can`t understand zip –help.. lol..

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 2 + 9 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.




Previous post:

Next post: