How to untar all tar files in a directory ?

Created August 29, 2022 | Viewed 437 | by Benjamin Edit


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

References