find the location of my-file.txt
in the files.tar
tar archive.
You can use this short tar command.
tar -tvf files.tar | grep myfile.txt
Or this more verbose tar command.
tar --list --verbose --file files.tar | grep myfile.txt
The commands above will list the files inside the files.tar
tar archive that match my-file.txt
.
If you don't recall the exact name of the file you need to find, you can grep for part of the filename Ie. grep my-file
.
-t
or --list
tells tar to extract an existing archivev
or --verbose
tells tar to produce verbose outputf
or --file
tells tar that the next parameter will be the tar file to create, extract, append to, list, etc.