Linux/Unix: Extract multiple .tar.gz/tar.bz2/tar.xz files files

Fig.01: Extract multiple .tar.gz files

Fig.01: Extract multiple .tar.gz files

To extract multiple .tar.gz/tar.bz2/tar.xz files files, run bash for loop as follows:
for i in *.tar.gz
do
tar xvf $i
done

If you run command as follows you will get various errors:
tar xvf *.gz
Sample outputs:

tar: mysql.tar.gz: Not found in archive
tar: www.tar.gz: Not found in archive
tar: Exiting with failure status due to previous errors

OR
tar -zxvf *.gz
Sample outputs:

tar: mysql.tar.gz: Not found in archive
tar: www.tar.gz: Not found in archive
tar: Exiting with failure status due to previous errors

OR
tar xvf "*.gz"
Sample outputs:

tar: *.gz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

OR
tar -zxvf '*.gz'
Sample outputs:

tar (child): *.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now

Examples and usage: How to extract multiple tar ball (*.tar.gz) files in directory on Linux or Unix