How to Compress & Extract Multiple Files in UNIX/Linux

How to Compress?

1. Go to the files directory. (as example, /test)

# cd /test
# ls 
file1.txt
file2.txt
file3.txt
file4.txt

2. Execute below command. The command will find the files and compress it together.

find . -type f -name "file*.txt" -exec gzip {} \; &

How to Extract?

1. Go to the files directory. Execute below command

gunzip *

Note:
You can execute the command as in background if the you are having >100 files. grep the process to find the current status.

You May Also Like

Leave a Reply?