Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 have 100 files, n1.txt, n2.txt,… and I want to gzip each of them, but not in one file – finally I'd like to have 100 n*.txt.gz files.

How can I do that in Linux with Bash?

share|improve this question
Did you check the man pages? They are great when you need to get help on the allowed syntax of a command. – mdpc Feb 18 '13 at 19:45

To compress all files, you can use:

gzip n*.txt

The n*.txt will expand to all file names as arguments for gzip.

share|improve this answer

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.