Monday, January 26, 2009

Software as a Subversive Activity, Part 11: Command Lines and Vintage Keyboards

Linux Monday: command lines and vintage keyboards

If you're younger than about 30, you probably don't have much memory of the DOS prompt. And about the third thing you've heard about Linux is "you have to type in commands a lot." (The first two were "it's hard" and "it's free.")

I'm still a little new at it, but by and large my experience has been that using the Linux command line isn't much more necessary than using the Windows Run command: it's an occasional thing, and if you really need it you'll usually be able to find step by step, cut and paste instructions.

The most valuable thing I learned in my abortive grad school experience was how to use a computer. Believe it or not, I, John Deeth, Linux geek and Data Man, was at one time a Luddite, derisive of computers in general, painstakingly rewriting and retyping.

It took exactly one month of grad school, and one rewrite of a paper on a manual typewriter, to get over that hangup. My writing style was scattershot and inspirational, based on my mental tangent of the monent, and my handwritten manuscripts were full of circles and arrows and inserts.

Cut, copy, paste... hey, this computer thing fits like a glove. Pretty soon I had stepped up to tweaking data files for games using edlin and not writing my thesis, that unfinished masterpiece about the Michael Dukakis campaign. But like I said, the most valuable thing I learned in grad school was computers. (More people will read this post than would have read that thesis, anyway.)

The first computer I used was a big ole AT or XT, probably about vintage 1985 (this was in 1988 and we grad students got the hand me downs from the faculty). Two 5 1/4 floppy drives, DOS 3.0, and IBM Writing Assistant. You could about squeeze a 20 page paper into a file, but then you needed an extra file for your title page and bibliography.

That initial experience is part of why the command line aspect of Linux doesn't scare me. I learned at the DOS prompt, and stayed there for nearly a decade, so a command line is just back to basics. (The first computer I owned, I bought used in 1990 and kept for seven years. That's also why, when forced to use Windows, I'm always in Windows Explorer: I spent seven years with the PC Tools file manager and its visual representation of the tree structure.)

Ah, memories of the DOS prompt, that blank slate C:\> that stared at you after bootup, waiting for you to work those vague commands. We forget now, but the original book that started the ubiquitous Dummies series was "DOS for Dummies." Then there was that old eight and three file name limit, like thschap1.bib for "thesis chapter 1 bibliography", and I know people who still use that and have memorized what those short file names mean. (Tangent: One of my favorite memories was a fellow who, when he had to make separate files for executive minutes and committee minutes, named the files minutes.com and minutes.exe, then wondered why he crashed his system when he tried to open them.)

The Linux command line is accessed through a program called a terminal, or a shell. In Ubuntu the default way to get through it is through a program menu: Applications -> Accessories -> Terminal. (I also tweaked my settings so that when I hit the Windows key on my laptop, I get the terminal, just as a little anti-Microsoft thing. Now all I need is a little penguin sticker, or a Ghostbusters red crossed out circle, to put over the Windows logo on the key.) You'll be greeted with zen simplicity:
john@john:~$

One of the first DOS commands I learned was dir, which listed the contents of a directory. That works in Linux, as does ls. Another old DOS command that translates is cd to change the directory.

Command names, in DOS and Unix (the progenitor of Linux) were all short like that. When everything is done at the command line, an economy of characters is essential, and if anything Unix/Linux commands are even shorter and more cryptic, yet mnemonic if you use them enough. Here's a few more (there's loads of cheat sheets):

DOS CommandLinux/UNIX Equivalent
DIRls
COPYcp
TYPEcat (or less)
RENAMEmv
ATTRIBchmod
DEL / ERASErm
RMDIR, RDrmdir
CDcd
CHKDSKfsck (huh huh, huh)
FDISKfdisk
HELPman
MEMfree
FCdiff
FINDgrep
SORTsort
IPCONFIG, WINIPCFGifconfig
NETSTATnetstat
COMMAND.COMbash
DEBUGgdb
EDLINed


man followed by a command is not a sexist thing; it'll get you instructions (a man-ual, remember the principle of saving keystrokes) of most any command.

The good news is, modern Linux has progressed to the point that you can get a whole system up and flying without ever touching the command line. Sure, that depends in part on your distribution. If you're an untergeek like me, using Ubuntu, you barely need to touch the terminal at all. If you want to be looking at a ~$ prompt a lot, try Slackware or Gentoo.

My favorite just-for-fun command at the moment is uptime, which tells you how long its been since a reboot. Some of my machines are on 15 days at the moment; it would be longer but we had a brief power outage. I've also had a couple kernel updates, which are the only time Linux asks you for a reboot. Not like Windows, where frequently something as basic as installing a program requires a restart.

Still, there's some handy tricks like
sudo apt-get update

which will update all the programs on your whole system. Your system software, your installed apps, everything. Sure, it's a (shudder) command line. But it's way easier than the one program at a time update process you'd need to do in Windows.

sudo apt-get clean

is handy, too; it'll get rid of the unnecessary files on your machine

cal must have been a handy little thing back in the pre-GUI dark ages. Three simple characters at the prompt gets you:
john@john:~$ cal
January 2009
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

john@john:~$

(The line breaks work right at the prompt better than they do in my html.)

Doesn't seem like much, but in Windows if I want a calendar, I have to open my clock and pretend I'm changing my system date. And more than once I've screwed up and actually changed it.

And if you're dealing with existential angst. the command line can help:
john@john-firebolt:~$ whoami
john
john@john:~$

"I was the walrus, but now I'm John," Lennon sang. whoami seems silly--unless you're a sysadmin juggling multiple accounts.




While I'm getting old school, I'm going to tangent into keyboards. Because if you're rockin' a command line, you need a good keyboard.

In some ways, we've come so far in computing: a 16 gig flash drive in my pocket, more computing power in your wristwatch than they landed the men on the moon with. But in some ways we've slipped.

Modern keyboards are disposable crap. I like old ones, the kind of keyboards I had on those first computers back in my grad student TA office. The keyboard at my desk probably weighs more than the laptop itself, and is half again wider. It's older than Windows so it doesn't have the Windows key.

The old keyboards have a half-inch, five pin connector called a DIN connector. (Aside: Plugs and connectors are always described as "male" and "female" ends. Really crude--but no one ever has to explain further and everyone gets it.) The DIN connector is so obsolete that I have to double-adapter it. The keyboard plugs into a DIN to PS/2 connecter (the quarter-inch or so plug, usually color-coded purple). That connector plugs into a PS/2 to USB connector, since USB is all my year-old laptop has.

The DIN keyboards are a little hard to come by. Resale junk shops are my only recourse, and Goodwill and the consignment places don't put computer gear on the shelves. I've picked up a couple at Salvation Army for a buck each.

Seems like a lot of effort for an affectation or an eccentricity. But the sturdy feel of old keyboards is great for a writer like me. The keys have some oomph to them and make a solid physical clack, which feels great when I'm on a roll or on a rant. Or sudo apt-get update.

Yes, I know I promised more Open Office vs. Micro$oft Office this week. Inspiration took me elsewhere; I'll get to it.)

No comments:

Post a Comment