March 30, 2013

End users are often somewhat frightened at the thought of using the command-line interface of their operating system.  If you’re not familiar with CLIs, think “Command Prompt” for modern versions of Windows (or just the underlying DOS interface for older versions of Windows) or the Terminal for Unix-based OSs such as Mac and Linux.  I have never been frightened by the command line.  In fact, since I was young, I enjoyed using the text-based interface.  It felt more “real”, more like I was actually getting the computer to do something.  This predilection for CLIs probably eased my transition from Windows to Linux a couple years ago, since a large number of Linux utilities must be run from the command line, or have greater flexibility and power if run from the command line instead of through a graphical user interface.

One of the useful features of *nix systems like Linux is the ability to pipe the output of one utility into the input of another.  One example of this I used just minutes ago is the “more” utility, which allows you to display a large amount of text output one line at a time.  Let’s look at a practical example (in fact, the one I just used).  Many Linux distributions have fairly user-friendly graphical interfaces for listing processes running on your computer, similar to the “Task Manager” utility on Windows.  However, I still end up using the command line utilities for taking a look at what’s running at any given time.  The “top” utility is somewhat similar to the Windows task manager in that it will give you a dynamic listing of the top processes running on your system, i.e., the ones using the CPU and memory to the greatest extent.

However, top doesn’t give you as complete a picture as the ps utility.  Entering ps -ef at the command line will list all running processes on your system as well as the process ID numbers for each process.  This is especially useful if you have a program that’s malfunctioning and can’t make it quit using the usual methods: just find the process ID, type in “kill xxxx” (where xxxx is usually a 4 or 5 digit process ID number), and the process is gone!  For me this was a revelation coming Task Manager, where clicking “End Process” often gave zero results.  Of course, the problem with the output from the ps utility is its detail.  It’s very difficult to sort through lines and lines of processes to find the one you’re looking for.  One solution (though certainly not the only one) is to pipe the output to the more utility: ps -ef | more.  More then prints the output to the visual display one line at a time, waiting for you to press enter after each line.

Less than twelve parsecs

March 23, 2013

Star Wars aficionados will recognize the title of this post (and blog) as being part of the claim Han Solo makes about the Millenium Falcon in Episode 4.  When asked about the speed of the ship, Solo replied that it made the Kessel Run in “less than twelve parsecs”.  Since the parsec is a unit of distance, I always wondered who made the mistake here: Lucas or Solo.  A quick check of Wikipedia reports that in one draft of the script Obi-Wan apparently criticized Solo for giving misleading information (since the parsec isn’t a unit of time), which suggests that Lucas was well aware that what Solo was saying didn’t really make any sense.  Of course, he also commented to the effect that navigational accuracy, rather than true speed, is what counts in superluminal travel, and so being able to plot a more direct course made the ship “faster”.  However, I’ve always been loath to accept this latter explanation, since navigational prowess lies with the pilot, not the ship (discounting any technological advantages in the ship’s navigational computer).  A friend of mine once gave a (joking) circuitous explanation in which the statement actually made sense if we take into account relativistic speeds and the Lorentz contraction; I wish I could reconstruct the argument.

That’s all for the first post; I’ll be following with weekly posts on science and technology.  I’ll finish up with a question: is the Lorentz contraction real or perceived?  Wikipedia reports that Lorentz said it was real, but Einstein said it was perceived (i.e., experimentally real but without physically affecting the moving body).  I’m no physicist, so I don’t know the background here.