Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a console application equivalent to Total Commander's fast file viewer (F3)?

Total Commander's (Windows app) F3 viewer can instantly "open" files of any size. The file contents is only read from the disk if you need it: that is, if you scroll or search inside the file.

Is there an alternative app for Linux/Ubuntu that will do the same, but from the console? Being a "console" app is essential, otherwise there are plenty of Total Commander alternatives that I know of having a "View"/F3 option.

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

There is a built-in file viewer for the console called "less", which is an enhanced version of the older Unix/Linux viewer "more" (which is also available). It is the same as the pager used for man, or the option --help.

with less, you can view a file one page at a time. Pressing space will move to the next page, and b wil back up a page. using a slash, /, will search (as in Vi), and n finds the next occurence.

There are more commands and options.

Oh, and to exit, you press q, which leaves the screen back to where it was previously, more or less.

Edit: In case it is not clear, to use less, you simply enter "less filename". And in case you didn't know, like almost every command, entering "less --help" gives a summary of usage.

share|improve this answer
    
Thanks! I didn't know less can work directly on files, and not only on redirected output. –  user12681 Sep 27 '12 at 22:46
    
So it's probably a good think I added the edit; I was a little afraid my answer might sound too obvious, but I forget I started with Unix around 1990, so what's obvious to me may be new to others. :) –  Marty Fried Sep 27 '12 at 23:15
add comment

I always do with Midnight commander. (mc)

It is not really a console app but startable from console and works great.

You can install it with:

sudo apt-get install mc

Hope thats what you are looking for.

share|improve this answer
    
It is actually console, and had forgotten about it. Was looking though for something more bare bones. Will mark as accepted if something else doesn't come up. –  user12681 Sep 27 '12 at 22:27
    
Do you know "vi"? It is not really easy to handle for beginners - but a great small tool. But it has no F3 option though. More here: linfo.org/vi/open.html –  Peterling Sep 27 '12 at 22:39
    
@Peterling: ... but it could be mapped to F3 if one wanted. vim has a read/only mode for viewing files, too. –  Marty Fried Sep 27 '12 at 22:41
    
Thanks for the tip with the mapping. And I thought as well that less or vi(m) would be too obvious. :) –  Peterling Sep 27 '12 at 23:37
    
Well I use vim as my main editor, but it won't work well for very very large files. Basically I wanted the behavior of TC's F3 or that of 'less filename' (which can "open" instantly files of any size). –  user12681 Sep 28 '12 at 23:50
add comment

Your Answer

 
discard

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