Tag Archives: view

andatool: Searching forever and ever

I had one more logging tool related to genstats and logintop10 that I wanted to point out, and unfortunately I can’t do much more than this when I show it.

2015-03-03-6m47421-andatool

That’s a disappointment on two counts, first being my relative dunderheaded attempts at feeding andatool a proper regex string. I’m dunderheaded about regex on the whole, so I suppose it’s not to be expected.

The other disappointment is in the fact that andatool is continually skimming through my /var/log/pacman.log file, forever and ever, looking for matching strings. As the log gets updated, the counts update … or they would, if I could get it working and show an animated image.

So you’ll have to use your imagination. Or you could build it yourself, give it a professional-grade regex string and a proper log to look at, and see how it works for you. Never trust me on these things. πŸ˜•

I can give you a few pointers though. You have to designate a file for andatool to skim through, with the -i flag, and you have to give it the full path. That might sound obvious, but I wrestled with that for a little bit.

Also, it seems more intuitive to use the -s flag each time, since that tells andatool to start at the beginning of the file and work the whole way through. I can imagine where it might be useful to omit it, but all of my best attempts were more interesting when I included that flag.

And I should mention that you’re not limited to one expression, so you could search through a log for several different instances, and watch each one update.

I don’t recall too many live log filter tools, so andatool seems worthy of mention. Not in AUR or Debian that I could find; don’t let that keep you from trying it though.

cam and cam: One for the eyes, one for the ears

In a rather odd twist, I have two programs entitled “cam,” one which has a visual focus, and another which has an audio purpose. Let’s start with the eyes.

2014-12-23-jsgqk71-cam

And I am beginning to believe that tools that translate from standard image formats to terminal output are not so rare after all.

This cam is available in the AUR as cam-git, but to be honest, the version given there wouldn’t build for me.

However, following the instructions on the home page made a workable cam, and as you can see, it converts our old pal Smiley into its text-only version with no real effort. It also manages a fair representation of the original colors, and shades things appropriately where it can.

cam also squeezes its output to fit the current terminal dimensions, without losing the aspect ratio — something I liked in the last converter we saw, and in others from years past.

cam seems eager to take on the role of a slideshow tool as well, with options for pausing between separate image files, preset looped shows, sizing in proportion to the terminal dimensions, and eight- or nine-position alignment that overwrites the current terminal content. It’s a nifty effect.

This cam is a solid thumbs-up in terms of graphics viewing for console environments, and unless you have something specific that you need from another converter tool, it might usurp others you already know.

Here’s the other cam, which is an acronym for CPU’s Audio Mixer. I’ve looked high and low for a home page for this cam, but the only sites I can see in the source code, and the only addresses I find in the Debian packages are all dead.

2014-12-23-jsgqk71-cam-02

Which might be a foregone conclusion, since cam’s source codes show dates as early as 1994, and I don’t expect the home page for an OSS-era audio mixer to survive 20 years until now. Not that it can’t be done, only that it doesn’t surprise me if it didn’t.

This cam seems to work well in hand with alsa-oss, but the only mixer controls I can muster are the ones you see in the screenshot.

I also can’t account for the oddball characters used in cam’s display, but I’m willing to either chalk that up to cam’s age, or to my less-than-expert setup, or using the Mint live environment. Any one or all could be a factor there.

This second cam might be a little less useful for those reasons, but it also has most of the requisites I look for in a decent console application — good use of color, onboard help and key cues, and a straightforward focus that doesn’t wander all over the map.

Still, it’s good to know it’s available, even if it’s not altogether as employable as it may have been. 😦

conspy: Take command of your command line

I can think of plenty of ways to use conspy, but I can’t really think of one that shows it in action, except perhaps for this.

2014-12-16-6m47421-conspy

It might take a few seconds to see what conspy is doing there: That’s the vc2 login on my Arch system, reproduced exactly in a terminal emulator.

In other words, you get a faithful rendition of what’s in the virtual console, inside another terminal instance. This might remind you of something like screen -x, but it’s quite different.

It’s terribly clever, and I know I’ve used it in the past, even if I don’t think I made a note of it either here or on the old blog. Which is an oversight, and I should apologize.

conspy allows you to send keystrokes to a tty too, which is probably where it might come in most handy. So you could, in theory, send commands to a vc that is either inaccessible or remote. And pairing this with ssh means you probably have an extra layer of control.

There are some obvious question marks that arise. For one, you might wonder at the usefulness of conspy if either your terminal or your console is of dramatically different dimensions.

For what I’ve seen, conspy plays it safe by leaving excess space blank when you have it, and by arbitrarily cutting off the display when you don’t. I haven’t tried resetting or resizing a framebuffer with conspy, and I don’t know if you’d have much luck using conspy with a framebuffer emulator. I leave it to you to pursue those options.

I also notice some discrepancies in what a virtual console shows, and what conspy can display. Even just htop has a few oddball characters in conspy, that otherwise look fine in the tty.

And sometimes there’s a little lag between sending characters through conspy and their appearance on the screen. It could just be the side effect of working with a machine that is out-of-date by more than a decade, but it’s something I see.

None of those issues hamstrings conspy in the least though, since conspy allows you to effectively peer into a vc, or even issue commands through it, from far away. That kind of usefulness — and its apparent freedom from other tools that might let you do something similar, like screen — make it a valuable tool in its own right.

imgcurses: Best of most worlds

My quick run-in with img2xterm yesterday reminded me that I have another curses-based image viewer in my list: imgcurses. If you’ve ever used something like fbida or fim, imgcurses might strike you as the best amalgamation of a framebuffer image viewer and a strict console environment.

With imgcurses you can get from this to any of these:

2014-09-02-6m47421-imgcurses-01 2014-09-02-6m47421-imgcurses-02 2014-09-02-6m47421-imgcurses-03 2014-09-02-6m47421-imgcurses-04

imgcurses has four “modes” that it supports, in the way it renders the image to text-only format. Depending on the image, one mode or another might be the best representation. (The last mode, “detail,” can be somewhat taxing to render, so be patient when you switch to it.)

The best parts of imgcurses are in the simple controls it offers. Left and right square brackets zoom the image in your viewing window, “m” changes the mode and “q” quits the program.

You can see a small on-screen display too, showing the original dimensions and zoom setting, and the mode you’re using. That’s about it.

imgcurses fills in a lot of the gaps that some others — like img2xterm — omit … like fitting an image to your available terminal space. So you won’t have to resize your image before you view it.

I don’t see controls for some higher-level image functions, like rotating or flipping, so you might have to rely on imagemagick for that. And according to the home page, imgcurses only handles JPEG, PNG and TGA formats.

I like this though, and plan to include it on my next text-only systems. It handles the task gracefully, gives a few options for display, and doesn’t overburden my system. Good show all around. Have a star: ⭐ πŸ˜‰

aview: Let me draw you a picture

Thinking back, I haven’t seen a whole lot of ASCII art viewers for the console, with the exception of the ones that come bundled with the aa or caca libraries.

aview can do this though, and has enough side options to keep you pressing keys at random, hoping for a suprise mode.

2014-07-16-6m47421-aview

I will tell you up front that aview wants its target file to be converted to PNM format, so you might want to dredge up imagemagick before you start in with aview.

Once it’s running though, you have quite a few nifty tricks at your disposal. aview is prepared to handle image inversions, several different types of dithering, zoom and un-zoom modes, frame-by-frame panning across images, and a lot more.

And I wasn’t joking about hitting keys at random: aview’s home page suggests there are some hidden features. If you find any, let me know. πŸ˜‰

One nice touch about aview: You can save the resulting image into an HTML file, or your choice of about eight or nine other formats, replete with display, character and other options. How’s it look? Well, you be the judge.

2014-07-16-6m47421-aview

Not gorgeous, but at least Tux isn’t embedded with evil hidden messages this time. πŸ™„ And that’s just the simplest of the available styles that I saw. Go crazy with that.

As a final note, I’ll mention that aview kicks into a graphical-ish mode if you trigger it from within a terminal emulator, which is why I demanded the curses driver in the gif above. It is smart enough to stick to text-only if you’re calling it from a virtual console though. (The caca suite was smart enough to do that too, if you remember that far back. cacaclock -f /usr/share/figlet/fonts/big.flf -d '%H:%M:%S' anyone? :mrgreen: )

And no, there’s no color, which I’m sure disappoints you as much as it does me. I will survive though, and I take some solace in noting that the last update to aview was more than a dozen years ago, if the home page is correct. I like software that can survive the times. πŸ˜‰

tig: The dream application

I have to give high marks to tig, a text-mode interface for git, even if I may never, ever, in this life or the next, have the chance to really put it to use.

2014-05-26-jk7h5f1-tig-01 2014-05-26-jk7h5f1-tig-02

That’s just lovely. Color everywhere. Line-drawn characters showing connections between revisions. Breakout panels for examining code in detail. Line-by-line color coordination for easy viewing. Intuitive controls. Left-and-right panning, as well as scrolling. Onboard help screens. One-key jump to $EDITOR. The list goes on.

tig is like my dream application. It’s as if someone read through every post I’d made for the past eight years and distilled it into one program.

And the irony is, I will probably never get to the point where I could use it. 😦

No matter. This is definitely worthy of a coveted K.Mandla gold star: ⭐ Enjoy. πŸ˜‰

tabview: csv files have never been cooler

Sometimes I find a utility so cool and obvious that I spend a few hours intentionally complicating life, just to watch it untangle things.

For example, I wrestled for about 10 minutes to come up with this …

2014-05-15-6m47421-tabview-01

just so I could watch tabview turn it into this:

2014-05-15-6m47421-tabview-02 2014-05-15-6m47421-tabview-03

(Thanks to rig for supplying the phony address book data.) tabview reads csv files (although as you can see, they don’t need a .csv extension) and drops them into a spreadsheet-ish arrangement for viewing purposes.

And that’s where it stops. No printing, no editing, no format conversion. Just view, simple sort by column, searching, primitive bookmarking, and maybe a highlighted header row.

That’s what I love about it most: tabview takes the tedious chore of skimming through csv files, then simplifies it, adds fundamental controls and options, and then knows enough not to pollute that genius with frills and foppery.

I won’t call it “perfect,” mostly because that word gets thrown around too much on this blog. It is possible to make it crash; I did it more than once trying to navigate and view cells on a super-large file.

And it also has a small flub in the aforementioned header row feature: The header data isn’t “pulled” from the data array, which means it appears twice in a row when you first open a file, and then gets mixed in with the other data if you sort the rows in any way.

And I don’t see where it’s possible to revert to the original data order, after you sort.

But to be honest, tabview is pretty much feature-complete for me. If it went any further in any direction, I’d lose interest. Do one thing. Do it well. Don’t drag my system down. Points are awarded for style.

Here’s a coveted K.Mandla gold star for tabview: ⭐ πŸ˜‰

sandy: An extremely svelte editor

By popular request, we’re dropping back quickly in the alphabet again, to cover a small editor that was unconscionably skipped over: sandy.

2014-05-07-6m47421-sandy-01 2014-05-07-6m47421-sandy-02

This is another whiz-bang tool from the suckless.org gang, which you might remember from a week or two ago when we cruised past sic. sandy has a similar feel to it, if an exceptionally streamlined performance can be considered similar.

As you can see, there is a terminal-wide selection bar that guides your eye to the line being edited, and new text gets a third color as it changes. I don’t recall seeing that approach anywhere else.

Most of sandy’s keystrokes and usage are in its man page, and I think it’s safe to say that most of them, if not all, are designed to follow editor conventions, and should be easy to pick up.

I like sandy for being a little unusual, a little intuitive, and very lightweight. I don’t know that I could look for more in an editor. And hey, it’s got color. πŸ˜€

The judges say: Another clever gadget from the suckless.org crew. πŸ˜‰

pv: Why won’t you talk to me?

One of the things that I remember being excited about when I started tinkering with Ubuntu all those years ago, was the sheer volume of new, free toys to play with.

There are, after all, some amazing, amazing tools available in Linux, and not just at the command line. Some of them just make your heart leap with joy as soon as you try them out.

Others … well, they’re useful, but they’re far from electrifying. For example:

kmandla@lv-r1fz6: ~/temp$ ls -lha
total 4.1G
drwxr-xr-x  2 kmandla users 4.0K Mar 19 14:25 .
drwxr-xr-x 27 kmandla users 4.0K Mar 19 15:07 ..
-rw-r--r--  1 kmandla users 4.0G Mar 19 13:15 sample-01.txt

kmandla@lv-r1fz6: ~/temp$ cp sample-01.txt /dev/null
_

And it sits there. And sits there. And sits there. With no clue as to what’s going on or what is happening, as if suddenly stricken dumb.

Now this on the other hand, is much better:

2014-03-19-lv-r1fz6-pv

See that? Why is it so hard for cp or one of the other core Unix-ish tools to just tell me what the heck is going on? I’m looking at you, dd. And mv.

This is not a new complaint. I have mentioned this before, with things like AdvancedCopy. Just a little clue as to what is going on in your head, computer. That’s all I want.

The beauty of pv, which is what’s working in the screenshot, is that it is very flexible. You can use it for progress bars on compression or decompression, network transfers, erasing floppy disks, spilling files into /dev/null … you name it.

You can even dump it into dialog, and give yourself a proper screenful of blue-and-red progress indicators … a la MS-DOS6.22 or something. πŸ˜‰

You’ll have to take a look at the help pages to see how the finer points are worked, but I’m sure you can handle it in its basic form. My best advice is to think of pv like cat, but smarter.

Now if only I could get a petition signed to have pv incorporated into the standard tools. … Ha! πŸ˜†

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. … 😈