CLI Week


So, I'm doing the whole 'cut back on the internet' thing again. Well, not really the internet so much as 'social networking' and other time-sink bullshit like Reddit. Stripping the internet from my life is impractical, so I'm not even going to pretend to do that.

My goal is for this to continue for the rest of the month (I began on the 1st, roughly), though who knows. I may turn this into a permanent thing, only allowing myself a visit to these sites once in a while -- maybe on Sundays or something. It's amazing how much more productive I am when I don't waste hours a day browsing Reddit or YouTube; I've written a number of bash scripts and a couple of very small C programs in the one week since I began.

Part of this is I've further 'limited' myself this week, just for funsies, to using only the CLI. Specifically, the virtual terminals (ttys) on my Slackware install. I don't start X at all, except to entertain my niece with Tuxpaint.

Why I've decided to do this, I couldn't say. I've always wondered if I could do it. "What if it's the apocalypse," I ask myself, "and there are no displays that can push pixels fast enough for X!!?"

I am cheating a bit, of course. I've got things set up so I can still watch videos and look at images on the framebuffer, so... truthfully, I'm not missing X nearly as much as I thought I would. In fact, I'm strongly considering extending this trial to two weeks instead of one. I will say that task management in the tty isn't something I've gotten used to as much as I'd like. It seems much easier when I can just alt-tab around. That being said, I'm glad that I've finally been forced to learn how to use UNIX jobs effectively.

I've never learned how to use the framebuffer so fast in my life. For those interested, you'll need a /dev/fb* device (mine is /dev/fb0). Slackware doesn't boot with one normally - at least, not my installation with proprietary NVidia drivers - so I had to edit /etc/lilo.conf to start with vga mode set to 791, rather than the default. It sounds more complicated than it is, just back up lilo.conf first if you plan to try it yourself.

After that, do what I do: Use mplayer and 'fbi', which is a framebuffer image viewer. I used sbopkg, though you can find the slackbuild for it at Alternately, if you're using another distro (such as Ubuntu or Arch), install it using the package manager. While I know that Ubuntu has it, Arch I'm less sure about it - though I'd bet money it's in the AUR if it isn't official.

To use mplayer with the framebuffer, execute it like so:

mplayer -vo fbdev /dev/fb0 VIDEO_FILE

Replace 'fbdev' with 'fbdev2' if you'd like your video to be centered, and '/dev/fb0' with your framebuffer device.

I've cooked up a couple of bash scripts to aid in my media consumption. 'fbplay' and 'fbplay2' both use mplayer and its fbdev2 video output to watch videos in the CLI, with extra arguments to properly scale the video and make it fullscreen (or nearly so). Which I use depends on the video. I've also written a script for fbi (named 'fbil') that makes viewing an entire directory of images or a list of images passed as arguments easier to view.

Scripts that I've written this week to make things easier for myself: