Category Archives: Arch Linux

A bash loop, for pacman

So long as I am mentioning rather esoteric bash solutions to even more esoteric file management problems, here’s one just for Arch Linux.

I’ve been transforming my Debian-based system into a ConnochaetOS-based one, and wanted to strip out a lot — a lot — of packages in one fell swoop.

pacman didn’t like my primitive attempts with wildcards though, and so as a means to yank anything that contained a particular string — like xf86, for example — I did this:

for i in `pacman -Q | grep xf86 | cut -d' ' -f-1` ; do pacman -Rcsn ${i} ; done

grep strains through pacman’s list of installed packages, and gives the list that includes anything in xf86.

Of course, pacman’s output includes version numbers, so those are trimmed off with cut, setting the delimiter to a single space.

Not great, not fancy, but for the most part, a solution.

Seven in a row

I am going to succumb for a few days to the overwhelming list of terminal applications I want to note. Ordinarily I try to space these out by a week or so at a time, but the list is growing faster than I can manage.

So here is day one of what will probably be two or three posts on console applications. Today: Hex editors and text editors.

I can think of exactly one occasion when I actually needed a proper hex editor, and unfortunately it was so long ago that I wasn’t even using Linux at the time.

Just the same, there is always the chance that something like this might come in handy, so here’s tweak, on the left, and beav.

 

Both work well and do the job as you would expect. beav gets a point for being easy to decipher, with on-screen help prompts and more interaction, but I couldn’t find an option to widen the screen display.

tweak is more or less the opposite, with a few options (like stretching the display over the width of the terminal :roll: ), but fewer on-screen tips and commands are a little more cryptic.

Both tweak and beav are more aligned to the emacs style of doing things — I believe both use CTRL+X CTRL+C to quit, as an example. Here’s one for the vi camp: hexer.

Probably simpler and less functional than the other two, but if you know vi you’ll be quicker at the starting line with this one. hexer, I should mention, feels a little less complete; perhaps it’s still a work in progress.

Enough with hex editors though; let’s move on.

Of course, mentioning a text editor for Linux is like pointing out one particular grain of sand on entire beach. There are just too many, with each of them doing something special in its own right.

All the same, I think I should point out the lighter, more unusual ones I find — that, after all, is my gimmick. I’ve mentioned e3 in the past; here it is again along with mg, joe and jed.


e3

mg

jed

joe

e3 is amazing for fitting a fully functional editor into a 10kb sliver, along with the option to use different command sets that are closer to what you’re familiar with. So that whole emacs-vi thing can go away for once.

mg is likewise a teeny little thing, but this one, as I understand it, is much like zile in its attempt to be a (much) lighter emacs.

I suppose, in that sense, both e3 and mg are useful to people who are accustomed to the way one particular editor works, but want something much, much smaller.

I have a hard time separating jed and joe in my mind (no joke intended there), but you might know joe as one of the editor options in the Arch Linux installation sequence.

joe works well for being obvious and easy to manage. Help commands are listed in a drop-down box, which makes them quick to find while you’re learning it. And it feels like an editor, if that makes sense.

jed, on the other hand, might be the most replete and easy to manage of the editors listed here. jed feels like a graphical application, with drop-down menus, windowed documents, and so forth.

But like I said, these are just four grains of sand on a huge beach of text editors for Linux. I’d be mad to ever mention another text editor again, and probably will be, just for mentioning these four.

There we are though, seven more I can cross off my list. Seven steps forward, ten steps back. … :|

Looking over Crux again

It’s been a while since I installed Crux on any machine in the house, and even longer since I put it on anything faster than about 150Mhz.

Just for old time’s sake, and to make sure I hadn’t lost my touch, and to see what would happen, I put it on the 2.5Ghz Celeron the other day, and did some system updates overnight. The end result:

That’s an 8-year-old machine jumping from Grub to the X desktop in just over 9 seconds. I don’t underconfigure my systems, so everything is working there — sound, network and what have you.

I also didn’t overconfigure it: CFLAGS are only -O2 and the recommended settings for a Pentium 4 Celeron, as per the Gentoo wiki.

So why so fast? No good reason … except for the one I mentioned a while ago, when I made the same pitch.

If you recall a speed jump when you moved from something gluttonous and bloated, like Ubuntu, to something sparse and clean, like Arch … well, you’ll see the same improvement when you move to something skeletal and streamlined.

To illustrate the point:

The same system, same hardware, same filesystem, but more than 20 seconds for Arch to start just to the console — and that’s with the network daemon backgrounded so it doesn’t hang while it contacts the router.

Of course, the day-to-day speed improvement comes at the cost of building up a system from scratch (more or less), and like a lot of my Crux systems, this one quickly went southward when I started tweaking it.

Plus, it took me two or three attempts just to get the kernel working, and another one or two to get the graphics system functional.

Personally, I consider that to be a good thing — I’ve learned a lot from Crux, and I can always stand to learn some more. I learn my making mistakes and figuring out how to solve them, or at least circumvent them.

So while I don’t use this much for faster, heavier machines, I still rely on it — sometimes too much — for low-end hardware and extra slow systems.

Because if it can trim Grub-to-X to under 10 seconds at 2.5Ghz, imagine what it can do for 150Mhz. :twisted:

P.S.: Sorry about the sideways videos. I thought YouTube let you rotate a video after posting it, but it appears that I am wrong. :|

One tool, one game, one clock

I still have a long list of console applications that I want to note. Sometimes this is for my benefit, and sometimes it’s in hopes of being someone else’s benefit.

Some of these I discovered via the wiki, which continues to be as much a resource for me as it is a way of discovering new talents for the terminal.

Starting as simply as possible, here’s concalc.

There are plenty of console-based calculators, and superficially it appears that concalc doesn’t do much that a reasonably educated bash user couldn’t do anyway.

It does handle scripting though, which might be of use to you, and it will no doubt streamline some more complex math functions if you need them at the terminal prompt.

And as is always the case with small, soft-spoken applications like this, there is a potential beyond the obvious. Take a closer look and see what you come up with.

Next is a game — pente.

Dating back a decade and still in the Debian repositories, pente is the traditional variant of go usually called five-in-a-row.

This one is easy to use and manage, with any number of console keys that will control the cursor for you, and a simple key press to place a marker.

This will run in either the console or in X supposedly, although it was nice to see that the Debian version didn’t incur any giant dependencies when installing it.

The last one today is a clock, and a rather nifty one at that.

 

This is tbclock, which I didn’t see in AUR or in Debian Squeeze, and that’s a shame really. It’s a very nice clock with a lot of color and movement to it, and a large improvement over the old binclock package — no matter how you dice it.

It also supports vertical arrangements, as you can see above, plus a digital readout to help us lesser beings understand what time it is, and a built-in game. :shock: This place has everything. …

Personally I’m going to jam this last one into my handy-dandy screensaver script for screen, and watch it do something while I do nothing. :)

That’s all for now. Three down, 400 more to go. …

Bend the universe to your will: Gearhead

It’s a fair bet that if I haven’t updated this page in a day, that something new has absorbed my attention. This time it’s Gearhead.

Before I start out, I should mention that yes, I found this the same way I’ve been finding a lot of new console programs lately, via Debian’s package search pages.

And yes, I mention this quick on the tail of freesweep, which I don’t actively dislike. I just prefer something with a little more … depth. Gearhead definitely comes through on that point.

Comes through in spades, really. Gearhead reminds me of my years of tabletop gaming, with cardboard tiles and hex maps, firing arcs and reload times and overheating weapons.

If you remember (or still play) things like BattleTech or Star Fleet Battles, Gearhead will be a natural transition for you. Many of the principles are the same.

But there’s a role-playing element at work here too — you’re not just ticking off ammunition and waiting to incur enough damage to knock over a robot.

I haven’t had the chance to dig very deeply into that aspect — I’ve only been playing for a day or so — but luckily there’s a wiki that will show you how to get started. Pilot attributes must count for something.

Personally I didn’t need much coaching to get started. Not that I’m some kind of genius or something, just that the game is menu-driven on almost every point, and most of the indicators and commands are fairly self-explanatory.

But with this much to absorb me, this is definitely going into my book as a keeper for the console — right alongside Crawl — as a game I can really sink my teeth into.

Some side notes: First, I know there is a Gearhead2, which I tried on my Pentium machine running Debian, but it was terrifically laggy and sometimes took 20-30 seconds to move between menu options.

I see on the wiki that Gearhead2 is described as “in the making,” so it might be that it’s sluggish because it’s not quite done. Or it might just be too heavy for 120Mhz.

Both are possible. But either way, I definitely have my hands full with Gearhead. I can wait a little bit for the sequel. ;)

Second, if you prefer a graphical version, I see that there are tile-based oblique-view animated versions that have developed around Gearhead{1,2}, much like the renditions that accompany Nethack, etc.

If you get one of those running, please send a screenshot. :)

You know you’re a CLI addict when

Your graphical desktops rely on terminal emulators for mundane tasks.

I show that with a little bit of hesitation. I usually reserve console-based applications for machines that really need it, and graphical ones for machines that can handle it.

Ergo, this one is a straight text-only machine, as is this one and this one. It’s true, the Mebius is doing all of that against X, but in my fabricated little world, I tell myself that it’s the same.

So it feels a little funny to be using the core duo with Openbox and Firefox … alongside htop and mc, all cued up by wbar.

But what can I say? I use mc on every other machine in the house, and it’s just the quickest and most comfortable for me. htop can’t be ignored either, although it has competition.

And if I were using Musca, I wouldn’t think twice about putting those two side-by-side on the same screen. That would just be natural for me.

So maybe I don’t need to rationalize. It does seem that I’ve come full circle in one sense though. Funny how life works. :roll:

Looking for ‘Life: zivot

I haven’t got much time today, so I can only jot a note as a signpost in a search for something else.

For a while I have been wondering why I couldn’t find a version of Conway’s Game of Life for the console, outside of the demo version packed in teapot or a few semi-eponymous “life” packages intended for graphical worlds.

I did find zivot the other day, but … it’s a little less than I anticipated.

This is more of a frame-by-frame snapshot of each stage, and not so much a full animated version. It seems odd to me that I can’t find something ncurses-based that animates the sequences more gracefully. I must be overlooking it.

I guess I’ll just have to stick with worms. :D