How to untar all tar files in a directory ?

Published: August 29, 2022

Updated: December 09, 2022

Tags: Linux;

DMCA.com Protection Status

Example of how to untar multiple files:

Untar one file

To untar a single tar archive:

tar -xf filename.tar

tar command option

Options: 
-c : Creates Archive 
-x : Extract the archive 
-f : creates archive with given filename 
-t : displays or lists files in archived file 
-u : archives and adds to an existing archive file 
-v : Displays Verbose Information 
-A : Concatenates the archive files 
-z : zip, tells tar command that creates tar file using gzip 
-j : filter archive tar file using tbzip 
-W : Verify a archive file 
-r : update or add file or directory in already existed .tar file

Untar all tar files in a directory

To untar all tar archive files, a solution is to create a loop. Launch a terminal and enter (in bash shell here):

for FILE in *; do tar -xf $FILE; done