Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to create zip of a folder from command-line. I can do something like
zip -r folder. I want to give the zipped folder same name as the original folder. I can simulate this by writing a script:

zip -r $1 $1  

And then doing ./script folder.

Is it possible to do this without writing any script?

share|improve this question
up vote 8 down vote accepted

You can add a bash function that does this to your .bashrc file:

function fzip {
    zip -r $1 $1

Then in the shell you can do:

user@host:~$ fzip my_folder
# creates
share|improve this answer

This is how you do it straight with the shell:

zip -r folder{.zip,}
share|improve this answer
awesome, thanks! – FloatingRock May 2 '15 at 7:33

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.