Server Fault is a question and answer site for system and network administrators. 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

All of my files in my linux server converted to gzip files I need a script for extracting all gzip files (*.gz files)

share|improve this question
How did this happen? Surely they didn't just all spontaneously gzip themselves. – EEAA Jun 29 '12 at 15:43
up vote 3 down vote accepted
$ find /path/to/files -name "*.gz" -print0 | xargs -0 gunzip
share|improve this answer
thank you for your help but can you show me an example of this command – FTM Jun 29 '12 at 15:46
I want to run this command in cpanel can I use cron jobs to do that? – FTM Jun 29 '12 at 15:47
The example is the answer. – EEAA Jun 29 '12 at 15:48
SSH into your server, then run the command. – EEAA Jun 29 '12 at 15:49
find /path/to/files -name "*.gz" -exec gunzip {} + has the same functionality as piping it to xargs, without the extra process or needing -print0/-0 support. – astrostl Jun 29 '12 at 15:58

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.