Cooking with Linux - The Virtual Streets of $HOME

Use Linux to visit virtual consoles, cities and battle zones.

François, what are you looking for on Freshmeat? Quoi? A program to digitize you so you can go inside the computer? Yes, I know what it looks like in the movies, but virtual reality hasn't quite made it there yet. I thought you understood that when we discussed lightcycles months ago. No, François, I don't think people are going to be living inside computers anytime soon. I'm not laughing at you, mon ami. I am just amused, that's all. No, I'm sorry to disappoint you, but I don't think there are cities or people in your Linux system either. We will discuss this later. Our guests will be here any moment, and we must be ready for them.

What did you say, mon ami? They are already here? Quickly, François, help our guests to their tables. Welcome, everyone, to Chez Marcel, where fine wine meets exceptional Linux fare and the most superb clientele. When you have finished seating our guests, François, head down to the wine cellar and bring back the 2002 Ctôes du Roussillon Villages.

François and I were just discussing the possibility of virtual worlds inside our computers, a truly amazing prospect but one that is still fantasy. It's true that amazing things have happened in the time I've been working with computers. Your Linux system is one of those things, and its open nature means a freedom to explore that simply doesn't exist elsewhere. Still, I keep thinking that the computing model in general is still in its infancy. Maybe it's because I watched too much science fiction and as a result, my expectations are a bit high. Think back to the movie Tron, for instance. In the opening sequence, Flynn the hero of the show, sends a program named CLU into the system to locate some missing files. CLU, the program, looks like Flynn and moves around in a 3-D tank while a companion bit offers yes or no advice. There are towering skyscraper-like structures all around as he navigates his tank down digital streets. That's the virtual computer world I wanted to experience in my younger days.

Ah, François, you have returned with the wine. Please, pour for our guests. May I suggest, mes amis, that you enjoy the many hidden flavors in this excellent red.

Although there may be no hidden worlds inside the system, plenty of things are otherwise hidden from view. Virtual consoles, for instance, scroll information that is hidden from view once your graphical desktop starts up. Sure, you could jump out of your graphical session with a Ctrl-Alt-F1 to see what is happening out there, but there is a better way. To view the hidden contents of that virtual console, type the following at a shell prompt (you will need root permissions for this):

cat /dev/vcs1

You see, what you may not know is that your system keeps track of the contents of those virtual consoles (1-6) in a special device file, /dev/sdaX, where X is the number of your virtual console. For example, here is a sample of the output of the first VT on my Ubuntu test system:

* Starting OpenBSD Secure Shell server...
[ ok ]  * Starting Bluetooth services...  hcid sdpd
[ ok ]  * Starting RAID monitoring services...
[ ok ]  * Starting anac(h)ronistic cron: anacron
[ ok ]  * Starting deferred execution scheduler...
[ ok ]  * Starting periodic command scheduler...
[ ok ]  * Checking battery state...
[ ok ]  * Starting TiMidity++ ALSA midi emulation...
[ ok ]
Ubuntu 6.04 "Dapper Drake" Development Branch francois tty1

This is interesting stuff, but it hardly qualifies as a hidden world, and it just doesn't have the Wow! factor my humble waiter is looking for. Yet, despite what I said to François, there are ways to see cities inside your Linux system. It's a bit of a stretch, but some fascinating visualization programs exist—experimental in nature—that try to create a real-world view of the virtual world of processes, memory and, of course, programs. One of these is Rudolf Hersen's ps3 (see the on-line Resources), and to take full advantage of ps3, you need a 3-D video card with acceleration.

Compiling the program is fairly simple, but it does require that you have the SDL development libraries:

tar -xjvf ps3-0.3.0.tar.bz2
cd ps3-0.3.0

To run the program, type ./ps3 from the same directory, and you should see a 3-D representation of your process table. When it starts, you may get something other than an ideal view, but that's the whole point of ps3. You can rotate the views in all three axes and look at the process table from above or below. If the processes are too high at the beginning, simply scale them down to something more reasonable. Each process is identified by its program name and its process ID.

Figure 1. Navigating system processes with ps3 is like flying down into a virtual city.

Navigating the ps3 display is done entirely with the mouse. Click the left-mouse button and drag to rotate and adjust the height and speed of horizontal rotation. Click and and drag using the right-mouse button to rotate the view horizontally and vertically. The wheel on your mouse lets you zoom in and out. To quit the ps3 viewer, press the letter Q on the keyboard.

ps3 is in no way a scientifically accurate means of viewing system processes, but it is enlightening and entertaining. So now we have virtual buildings and the makings of a virtual city somewhere inside your system. All we're missing now are tanks. Well, I may have an answer to that one as well. It's called BZFlag, and this certainly calls for François to refill our glasses. Mon ami, if you please.



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


luke_wilson's picture

You see, what you may not know is that your system keeps track of the contents of those virtual consoles (1-6) in a special device file, /dev/sdaX
Just a little slip but /dev/sdaX refers to a scsi drive not the virtual console /dev/vcs1 mentioned previously in the article.


marcel's picture

Hello Luke,

Well, Sacré Bleu! I knew what I was typing before hand but another device file snuck in there accidentally. You are absolutely correct to point it out. That should have been /dev/vcsX for the virtual console device. And I thought it was such a cool trick, too . . . [ insert appropriate smiley here ].

Thanks again, and take care out there.

-- Marcel

Marcel (Writer and Free Thinker at Large) Gagné AND