1

I'm having a large number of tar files and need to browse through them. Is there something like a curses/ncurses tar browser (like midnight commander or ncdu)? I know the -t option for tar but it is not what I need since it lists all files and not in a directory tree.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
mfnalex
  • 221
  • 1
  • 2
  • 8

2 Answers2

4

You can explore your archives from the shell with a filesystem that makes archives appear as directories. AVFS is a virtual filesystem (based on FUSE) that allows you to see inside archives as if they were directories. It's available as a package in many distributions. Run mountavfs once and for all (it'll persist until the next reboot; you should put it in your ~/.profile). This creates a view of the whole filesystem rooted at ~/.avfs. Inside this view, every archive has an associated directory whose name has an extra # at the end. This directory contains the contents of the archive.

mountavfs
cd ~/.avfs$PWD
ls *.tar
cd foo.tar\#
ls

If you prefer to use a full-screen program to browse the directory, then AVFS isn't so convenient because the directory corresponding to the archive does not appear in the directory listing, so you would have to explicitly visit each archive file. But some programs have archive browsing built in. Try Midnight Commander (mc, available as a package in many distributions).

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
  • Thank you very much, but I'm using a VPS and my hoster does not support FUSE. – mfnalex Mar 04 '17 at 16:25
  • Sorry, I didn't read you also mentioned midnight commander. That was exactly what I needed, I just didn't know it was able to do that, so thanks! – mfnalex Mar 04 '17 at 16:42
1

Use t option and pipe into less with optional v option (verbose). eg

tar tvf mytarfile.tar |less

It's easy to search for a pattern in less. Use the / command

If you wish to restrict to a known directory

tar tvf mytarfile.tar path/to/ADirectory | less 
X Tian
  • 10,413
  • 2
  • 33
  • 48
  • 1
    Except: "I know the -t option for tar but it is not what I need since it lists all files and not in a directory tree." – Jeff Schaller Mar 04 '17 at 14:54
  • As I said, I know the -t option and need to have an interactive interface in which I can navigate. Thank you anyway. – mfnalex Mar 04 '17 at 16:27