Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I tried using -t like the man says, but it just waits.

Example

$ tar -t archive.tar 
 (nothing)
share|improve this question
    
It is waiting to read stdin, and trying to tell you about/if "archive.tar" in that stream. What you want to do is already answered below. Check one? –  Roboprog Dec 3 '09 at 0:00

2 Answers 2

up vote 6 down vote accepted

I needed to add the f flag to tell tar I'm specifying the filename, i.e.

$ tar -tf archive.tar
file1.txt
file2.txt
$
share|improve this answer

You can also increase the number of details listed:

$ tar -tvf archive.tar
-rw-r--r--  0 user group       0  3 Dez 00:21 file1.txt
-rw-r--r--  0 user group       0  3 Dez 00:21 file2.txt

While the -x switch is usually used to extract the whole content of an archive, you can also use it to extract a single file or directory:

$ tar -xvf test.tar file1.txt
x file1.txt

Best wishes, Fabian

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.