Extract and delete all .gz in a directory- Linux
There's more than one way to do this obviously.
# This will find files recursively (you can limit it by using some 'find' parameters. # see the man pages # Final backslash required for exec example to work find . -name '*.gz' -exec gunzip '{}' \; # This will do it only in the current directory for a in *.gz; do gunzip $a; done
I'm sure there's other ways as well, but this is probably the simplest.
And to remove it, just do a rm -rf *.gz
in the applicable directory