mpstat: Quickdraw processor statistics

Back in April I brushed up against the sysstat suite while mentioning sar. sar is just one of a cluster of tools you get when you install sysstat; another one is mpstat.

2014-07-22-6m47421-mpstat

mpstat shares some features with sar, mostly in its ability to generate processor statistics at intervals, and a set number of times. This is useful in the same way as sar, by allowing you to poll the processor when you know it will be taxed.

Commands are also similar; sar 2 5 will behave in the same way as mpstat 2 5, with some small but obvious variations.

Taking into account the other programs that are available in sysstat (some of which will come later), there’s not a huge difference between sar and mpstat, except perhaps in the specific processor data either one offers. By default, sar shows a little less, and mpstat shows a little more. But some is shared between the two.

And you can’t really appreciate it with this machine, but mpstat has the ability to split out its results according to processor. That might be important if you’re working with one of these. :shock: I keep watching the recycling shop, but nothing yet. …

mpstat‘s output is sparse enough and well-spaced enough that you might consider cramming it into some other application. colorwrapper, anyone? ;)

iftopcolor: Please do not feed the bloggers

If you think you can win my affection just by taking time-honored mainstays of the Linux software landscape and injecting them with color … well, you can.

2014-07-22-6m47421-iftopcolor

neosrix left a note late last year about a colorized iftop — rather cleverly called iftopcolor — and I should have known better than to wait this long to check it out.

As best I can tell, it’s feature-identical to the standard iftop utility, but adds blue and green indicators for up/down transfer speeds.

Which in turn makes iftopcolor much more readable than its progenitor. Don’t get me wrong: The original is an excellent program. But just by virtue of its layout and the way the animation works, it’s particularly difficult to read — especially when it’s running wide open.

If you keep an eye on transfer stats, iftop alone is useful, but iftopcolor is a giant leap forward in ease-of-use. If you have a machine with multiple interfaces, I daresay it will be a lifesaver.

And I feel gratified to see a useful tool like iftop get a healthy swath of color. :mrgreen: Now ladies and gentlemen, you know the rules: Please do not feed the bloggers. ;)

howdoi: Because the Internet knows more than you

I picked howdoi as a complement to betty today, because in some ways, they both do similar things.

2014-07-21-6m47421-howdoi

Whereas betty would reply with set answers (provided she knew the questions :roll: ), howdoi acts as a conduit between you and that vast cesspool in the sky, The Internet. Give howdoi a few key terms, and it will give back what it hopes is an answer to your conundrum.

howdoi is aimed mostly at coders, as I understand it, but as you can see, it will handle system admin or just bash issues too. I even asked it a question or two about vim, and I think it gave the right answer. It’s hard to tell with vim. :| I didn’t ask it for the weather in London. :roll:

If you tinker with howdoi for a few minutes, you’ll see what it’s doing: searching through StackOverflow, and replying with a best-case answer formatted for your screen. If you ask nicely (in other words, use the -a and/or the -c flags) it will prettify the result, and give a link to where it was found.

I can’t fault howdoi very much, since for the most part, it seems to give the right answers. On the other hand, as you can see above, it doesn’t really know what you’re asking — I don’t think that is the right command to add a user with bash. ;) So remember: It’s just handing down the wisdom of the unwashed masses, and hoping you will be pacified.

In that way, howdoi is really just a well-designed search utility for the console, like surfraw is and a few other tools do. I’d have to check to see how it’s designed, and whether it actually looks through more than just StackOverflow; I’ve only seen links to that site.

So in all, I can’t complain about howdoi the same way I do about betty. If you’re a coder and you sometimes find yourself fishing for snippets, howdoi is a short and quick tool that gives out just the right amount of info. On the other hand, be aware that while the Internet will always know more than you, what it knows isn’t necessarily something you want to learn.

P.S., Yes, there is an elvi for StackOverflow in surfraw. In case you were headed there next to check. …

betty: Anti-aliasing

I have two applications within a theme today; one of them I talked about a month ago on some other random site, and the other is relatively new. Or it is to me, anyway.

First up is betty.

2014-07-21-6m47421-betty

betty was steamrolling the Linux underbelly of the Internet for a while this summer, winning fans as a “Siri for the console.” Proponents suggested you could type just about any request of betty, and she would run the appropriate command and provide results. Rather than learning esoteric commands and flag sequences, betty could translate a request, pump it through the appropriate tool, and give you back an answer.

Which sounds like a fantastic idea, and I’m fully on board with betty … except as you can see above, it doesn’t quite work.

betty has preset commands she understands, most (all?) of which are listed on her home page. Deviate one character from those, and she’s lost.

Or worse, there are a few that supposedly work, that don’t. That’s what I hoped to show in the screenshot: that my typing skills were not to blame for betty’s empty replies.

I won’t harp too much on betty because I got most of my shots in last month, when fanboys hailed betty as The Golden Child of Linux and promised she would revolutionize life at the cursor. Suffice to say that betty doesn’t actually translate your commands, doesn’t parse context for a reply, and doesn’t tolerate deviation from her set list … hopefully.

Which means at best, betty works the opposite of an alias. Instead of just typing date +"%A", you’re typing in betty whats today, then sifting through her possible responses. If you hoped to save time typing, you didn’t.

And if you need to know the day of the week so frequently that you’d consider using betty for it, you’d do as well to use alias dow='date +"%A"', and do things the old-fashioned way.

But that’s enough for now. It will be a while before betty fulfills her promises, and becomes the natural language translator for the console. In that time, imagine how many traditional commands you could learn. … :???:

gnus: As close as I could get

I feel a little disappointed in myself: This is the best I did with emacs‘ built-in newsreader-plus-e-mail-client, gnus.

2014-07-20-6m47421-gnus

I am ashamed. I think I spent the better part of an hour too, trying to get all the options set, and still came up with a great big goose egg. :(

The sad part is — even after all that time, and being fairly confident that it was really connecting to nntp.aioe.org, and having moderate success with slrn a few months ago — I don’t have any worthy notes to mark here. Everything I tried either failed outright, caused emacs to sputter error messages, or just gave me “No news is good news.”

Ah well, the best-laid plans of mice and men. I do feel guilty now for not trying harder with wanderlust though. :(

I can give you the home page for gnus, and tell you that the documentation is very detailed and very easy to read. There are even a few comic moments deep in there, but I am so far gone from picking through them that I don’t remember where those jokes were at. :???:

I feel I should mention that if you just search the Internet for “gnus setup”, a large portion of your results will be how to make gnus play nicely with GMail. I didn’t go in that direction, mostly because I had gnus in my notes as a newsreader, and I was interested in seeing how it compared with slrn and tin.

As it stands, I’ll leave it to the emacs experts to clue me in. The irony of the entire situation was, every time I needed to edit a configuration file, I instinctively did it with vim. I didn’t even think about it until I had done it four or five times in a row. … :oops:

mp3rename: Rename and organize, in one fell swoop

No, it is not reruns week for K.Mandla. Back in January we had a little CLI tool named mp3rename, and now again, here’s a CLI tool named mp3rename.

2014-07-20-6m47421-mp3rename

Two separate tools with much the same approach and results. This mp3rename, which dates back to 2003 supposedly, adds the feature of organizing the output files, in a similar fashion to mussort. I don’t recall seeing this outside of one or two other utilities.

This mp3rename is a little convoluted to work with; I found I had to call specifically for the IDv3 tag to be used, or it came up with no data to sort or rename on. That might just be my files though.

And it’s worth mentioning that the renaming options seemed to stutter if they weren’t explicitly listed in the command, even though the help flag suggests there’s a “default” string mp3rename will fall back to. I got a lot of errors until I used one I drew up with no spaces, and tacked it on to the end of the command.

If you try this in Arch, you’ll need both perl-mp3-info from extra and perl-mp3-tag out of AUR. Offhand, I’m not sure what those correspond to in Debian; my search for “perl mp3” was somewhat scattered.

In all, this mp3rename — aside from the option to organize mp3s according to artist and album — doesn’t differ a whole lot from the other one. And goodness knows there are lots of other scripts, some specific to file types, that will do the same in much the same way.

The lesson to be learned here is, if you are a young Turk in software design circles, the command-line mp3 renamer utility has been done. And done, and done, and done, and done. … :|

ansiweather: One-line weather report, with frills

If it seems like most of the titles thus far are in the early part of the alphabet, that is only to be expected. There hasn’t been much of a chance to pull in titles from the latter half, after scraping through everything after about section N onward.

So just by virtue of time and random chance, a lot of what I have is in the A through M portion. I hope that doesn’t disappoint. ;)

Here’s ansiweather, which might seem a bit minimalistic at first.

2014-07-19-6m47421-ansiweather-01

Mmm, color. :D Let’s get a close-up, and give ansiweather a chance to shine.

2014-07-19-6m47421-ansiweather-02

Whoa! Okay! That’s too close. But I think you can see one of ansiweather’s high points there: the use of specific weather ideographs as embellishments.

ansiweather also allows for forecast data, specific date formats, and of course, specific locations. All condensed into a single-line display.

Pretty cool. Colorful, terse, customizable, lightweight. I can find nothing wrong. Except of course, that those little umbrellas and clouds probably won’t show up in a virtual console. That’s a mighty small complaint though.

At this point, ansiweather is probably either a stroke of genius to you, or something so completely understated as to be rubbish. But consider adding ansiweather to …

  • vtclock, which allows you to pipe in the results of a command. Now you have a weather clock for your desktop;
  • Your .bashrc / .bash_profile, or maybe even somehow part of /etc/issue, which would give every console a weather report at login. This one might take a little effort to produce.
  • ticker or ticker, either of which will scroll that information across your console, vertically or horizontally;
  • figlet, or for real craziness, toilet … say no more;
  • or even just watch, which will allow you to paint it into a corner and update at set intervals. If you use a graphical desktop, try a terminal emulator set to be completely transparent, forced to the root desktop, reshaped to only one or two lines, and updating ansiweather at intervals. It’s like conky, without conky. ;)

You might also consider cramming this into a terminal multiplexer, either as a specific panel or “desktop widget,” or through some sort of built-in status bar. Let me know if you figure that one out.

At first ansiweather might seem like a triviality, but like a lot of things with Linux, it’s not the tool that matters. It’s how you use it. ;)