layout | title | tags |
---|---|---|
manual |
tar -t | List files before extracting |
tar |
When we need to archive files or directories, we use command tar
to do the work.
tar
stands for tap archives
.
-t
is the abbreviation of list
.
List archive contents to stdout. The long option form is --list
.
It is possible that the size of a archived tar file is large and contains lots of files inside. With option -t
, we don't need extract the tar file to find particular files.
We can use option -t
to list the files inside first, and then use pipe
to pass the results to another tool grep
to see if particular files are inside this archived file.
This can help us to save time because the extraction might take a long time.
Mac BSD General Commands Manual
Here is the example of tar -t
.
tar -t
List files inside the archive file.
$ tar -tf archived.tar
tarFiles/
tarFiles/file3
tarFiles/file2
tarFiles/file1
$ tar -tf archived.tar|grep "file3"
tarFiles/file3