List the contents of a tar archive

Solved
stephbret56 Posted messages 195 Status Member -  
stephbret56 Posted messages 195 Status Member -
Hello,
I am looking for a way to list the contents of an archive on tape; this archive is created by tar.
The name of the archive is save.tar.
I would like to have a view identical to the output of the ls -al command for a directory.
If I use tar tvf .... is it possible? And how?

Best regards,

13 answers

  1. jipicy Posted messages 40842 Registration date   Status Moderator Last intervention   4 898
     
    Hello,

    tar -tf file.tar

    --
    JP - Penguin Breeder -
    Do something for the environment, close your windows and adopt a penguin.
    15
  2. stephbret56 Posted messages 195 Status Member 6
     
    Yes, but I don't have the contents of my archive.
    I would like to have the directories and files that are inside it.
    Is there an option for that?
    Thank you.
    2
  3. stephbret56 Posted messages 195 Status Member 6
     
    I still can't list the contents of the tar archive file on my cartridge
    Is there a solution in tar or another method to do it?

    Thank you for your help
    0
  4. dubcek Posted messages 18627 Registration date   Status Contributor Last intervention   5 660
     
    tar -tvf filename.tar or device:/dev/rmt0
    what type of cartridge?
    0
  5. stephbret56 Posted messages 195 Status Member 6
     
    It's DDS3
    When I run tar -tvf, I can see the archive file on the tape but not the content of the archive.

    tar -tvf /dev/rmt0
    -rw-r--r-- 201 1 1073741312 Apr 7 11:43:51 2008 /Mon_Repertoire/save.tar
    0
  6. dubcek Posted messages 18627 Registration date   Status Contributor Last intervention   5 660
     
    because it's an archive of an archive !! it needs to be extracted:
    tar -xvf /dev/rmt0 ; tar -tvf save.tar
    or maybe
    dd if=/dev/rmt0 | tar -tvf -
    or maybe
    mkfifo save.tar
    tar -tvf save.tar &
    tar -xf /dev/rmt0 save.tar
    0
  7. stephbret56 Posted messages 195 Status Member 6
     
    Yes, but if I do that tar -xvf /dev/rmt0 ; tar -tvf save.tar, I will then restore my entire archive to the disk, right?
    0
  8. dubcek Posted messages 18627 Registration date   Status Contributor Last intervention   5 660
     
    yes
    0
  9. stephbret56 Posted messages 195 Status Member 6
     
    Wah well is there nothing else?
    However, I didn't quite understand the use of the other examples
    Can I use dd in the command line and the rest too, or through a script?

    Or maybe
    dd if=/dev/rmt0 | tar -tvf -
    Or maybe
    mkfifo save.tar
    tar -tvf save.tar &
    tar -xf /dev/rmt0 save.tar

    Thank you for your help.
    0
  10. dubcek Posted messages 18627 Registration date   Status Contributor Last intervention   5 660
     
    yes, in command line
    why create an archive of an archive, tar can write to tape:
    tar -cvf /dev/rmt0 my_directory
    would have been enough
    and tar -tvf /dev/rmt0
    would have listed all the files
    0
  11. stephbret56 Posted messages 195 Status Member 6
     
    Yes, but given my needs, I have to archive on disk and then onto the cartridge
    Since I have to make the same two backups but at different times and my archive name has to change so that I can find my bits on the cartridge during a restore, I don't know how to do it otherwise.

    Thank you
    0
  12. dubcek Posted messages 18627 Registration date   Status Contributor Last intervention   5 660
     
    Then make a list of files at the time of the disk archive
    tar -cvf save.tar my_directory > list.txt
    0
  13. stephbret56 Posted messages 195 Status Member 6
     
    Yes, I had thought of this solution, I will do it like that, I close my question.

    Thank you very much to everyone for the help and have a good evening.
    0