Tag Archives: pager

pg: A little underfeatured, a little overweight

I held back pg from the list of coreutils extras last week, because I wanted to take a closer look and see if I was misusing it.

pg is a pager, but it seems terribly rudimentary. Perhaps that’s because I usually rely on most, which has quite a lot of features.

2014-10-07-6m47421-pg-01

At the same time though, pg seems to be taking up a rather large chunk of memory, for what it does.

2014-10-07-6m47421-pg-02

That’s about the lowest value I could get for pg‘s memory usage, and on the grand scale of things, 380Kb is not a terrible number. After all, most needs about four times that to display the same file.

But it does point out some of pg‘s shortcomings, in particular its lack of (or my inability to find) a way to move backward in a file. There are keypresses for the end of a file, for previous and next files, but I can’t get pg to roll back in the current file.

I might be overlooking it, but even aside from all its other quirks, it’s a dealbreaker for me. A one-way pager is not really any better than ls with CTRL+S or maybe SHIFT+Page_Up. Actually, come to think of it, SHIFT+Page_Up would be an improvement over pg. 🙄

So I leave it at that. If I’m being terrifically obtuse and overlooking the obvious answer, please let me know. In the mean time I’m going to keep banging my head against the wall, because it feels good when I stop. :\

pinfo: A new viewpoint is always welcome

This is subtle, so it might take a few passes before you can see what’s going on here:

2014-03-03-lv-r1fz6-pinfo

That’s pinfo, and it’s perusing its own man page. But pinfo is hard-wired to follow “links,” which I quoted because those aren’t really links like you’re used to in a browser.

So if you watch closely you can see where it jumps from pinfo to curs_getch, then wresize, then resizeterm, and so forth. Almost like a browser, but through man pages.

I really like this. More than once I’ve wanted to jump through man pages like web pages, and this can do it from the console, and with color, and offline if necessary.

pinfo doesn’t just peruse man pages though, it can handle info files and has a few other options to investigate. Both Arch and Debian have pinfo in their repos.

I’m going to try to use this as my $PAGER and see if it creates any havoc. I expect to have it jump into view whenever a program calls for a help page, but that’s just my expectations.

More news later. 😉

most: More than more and less

I’ve been pitching most as the pager of the future for years now, and I’d like to think the reasons are obvious.

2014-01-14-lv-r1fz6-most

Color. 😐

Just kidding. 😉 I prefer most over more or less, mostly because it carries a lot of features that you wouldn’t expect in a pager.

My two favorites are right there in the screenshot, but one you can’t really see. Multiple split screens are awesome when you want to look at the top and bottom of a file.

And most is clever enough to have a toggle option for word wrapping — which isn’t visible there, really. Sounds minor, but it’s a huge relief when you need it.

most was written (I believe) by the author of jed, and in a way it shows. Or perhaps it just makes sense to me, since I know full well jed is the editor I ought to be using, but don’t.

The less I say about most, the better. most is more than more and it’s more than less, and that’s enough reason for me to use it. To each his own, of course, but for me, most.

more: Already shown to be less

You’ll probably find more in util-linux in your distro. We sort of looked at more a month ago, when we cruised past less.

2014-01-13-lv-r1fz6-more

The opportunity is here for some great puns, but I think most of them were invested in less, so we don’t need any more. 🙄

And by comparison, more is anything but that. Most of the features that were built into less were additions to the more corpus, meaning if anything, more is less than less.

All the same, if you need a fundamental pager, chances are your system comes with more. If you use a pager regularly, you probably won’t want more though — you’ll want less, if not most. Later for that one though. 😉

mcdiff, mcedit mcview: Internal tools, externalized

I can’t mention mc without pointing out that at least three of its internal tools — a diff’er, an editor and a viewer — are accessible without actually starting mc straightaway.

2014-01-05-lv-r1fz6-mcdiff 2014-01-05-lv-r1fz6-mcedit 2014-01-05-lv-r1fz6-mcview

Left to right, mcdiff, mcedit and mcview. McThankYou. 🙄

As far as I can tell, these are mirror images of what you get when you cue the tools from within mc. And as you can see, they all follow mc’s general look and feel.

I am not a huge fan of any of those sub-programs, but I will admit I use the viewer frequently, if I’m already in Midnight Commander.

For most other uses, I rely on vim, diff and most, depending.

Point being, if you become accustomed to mc’s style and arrangement, and you don’t ally yourself with any particular viewer or editor, these three might save you a little disk space … and spare you learning another whole program. 😐

less: Do more with less

My Internet connection was completely kaput yesterday and is still a little flaky today. To avoid installing new stuff, I’m going to jump out of alphabetical order slightly, and talk about less.

“Talk about less,” not “talk less.” This is a blog, after all. Talking less is an impossibility for most people who do this. 😐

So here we go. Probably you’ve used less, and maybe more, and possibly even most.

Either way, I have been looking forward to this, simply for the chance to work in some double entendres. :mrgreen:

But also because digging more into less has exposed a few of my own misconceptions, and shown that you can do much more with less, and sometimes even more with less than with most. 🙂

What is likely invisible to less users, is the fact that less takes on quite a few options, and will do a lot more if given the chance.

And what was a misconception for me until earlier today, is that less is designed after more. I thought it was more that followed less.

You can watch this gif while you wrap your head around that last one.

2013-12-18-lv-r1fz6-less

My preliminary suggestion — and this is just me — is that I prefer to see some kind of indicator bar. Press the hyphen and then a capital M for a long status display.

Most people use less to skim or search, and so let’s do that first. You can navigate less with the keystrokes from vi(m), which may score another point for the vim team.

Search is done with the slash key, and you can follow that with the traditional asterisk and question mark wildcards. That much you might expect.

/Life

By default, less will highlight (or reverse) the terms it finds. You can turn off the highlighting with ESC-u.

All that is fine and dandy, but here’s something cool: less can page through several files in a row, and search through all of them at once.

So if you have a … I don’t know, maybe a list of movies or songs, and you don’t know where the title appears, less can search through all of them and find it for you. Here’s a list scalped off a movie directory eons ago. Enter a search term, and bounce to the next file with ESC-n.

2013-12-18-lv-r1fz6-less-esc-n

more doesn’t do this. most can do it, but it’s not an explicit part of the search feature; you’re actually searching, then switching files, then searching again. Not the same thing.

So what if you’re sifting through something quite dense, and you’re lost in all the reversed text? How about a status column, to catch your eye and help you find the current term? Enter this while less is running, or as a command flag.

-J

That’s a hyphen, followed by a capital J. You should get a single column to the left of your search results, marked with a reversed asterisk (how very C64).

Un-highlight (with ESC-u) and you’re left only with asterisks marking lines with matching terms. Nifty.

less also does some greppish stuff. Instead of the slash, try searching with the ampersand.

&The

2013-12-18-lv-r1fz6-less-ampersand

What’s happening there? Well, instead of all the text and highlighting matching lines, you’re getting a sifted list of matching stuff only. Lines that don’t contain “The” aren’t shown. Woo-hoo, a pageable grep.

To really satisfy the need for recursivity, try using the ampersand again, to filter it down to two or three.

If you’re paranoid like me it’s worth mentioning that less stashes your search history and a few other notes about it’s brief life experiences in your home folder as .lesshst, which I promptly delete. Nothing incriminating in there, I just don’t like leftovers clogging up my home directory.

You can also configure less to run with the same options each time, like a customized status bar or personalized key commands (ahem, emacs fans).

But all of this you already knew, because less is in the default software for about 90 percent of the distros out there, including yours, right?

Maybe you did and maybe you didn’t at least now you know more. I mean less. I mean more about less. I could go on like this for days. … 😈

fbless: The things I learn

Until I started poking around with fbless, I hadn’t ever heard of fictionbook format. Wikipedia tells me it originated in Russia and is still popular there; that’s the first I knew of it, and still pretty much is all I know.

2013-11-04-lv-r1fz6-fbless

fbless is nothing terribly complex. Best I can tell, it parses the format and spins the text out through a less-like viewer. Many of the same commands are available, so you can page through a document, jump back to the top or see how the story ends, or search the text for strings.

That’s about it. I know this is a very superficial once-over, but fbless itself carries no documentation, accepts no help flags, and the home page is in Russian. 😐

I can send it through Google Translate, but that doesn’t tell me a lot that I didn’t already know. I suppose something like this should be accepted for what it does, not what it doesn’t do.

So I can’t really say anything bad about fbless. I don’t feel like I was sold short; in fact I learned one or two new things. I should get that much out of every little program I install. 😉