If you have gotten through parts 1 and 2 of our series, you now have a sparkling new Linux system that displays -- a prompt! But if you think it only displays one prompt, you'd be wrong, as we shall soon see.
Let's fire up our system and log in again as the root user.
One of the commands I often use is locate, which rapidly searches a small database of files installed on the system. locate is installed on our system but when we try to use it we get the following message:
linuxbox:~# locate foo
locate: can not open `/var/lib/mlocate/mlocate.db': No such file or directory
This message appears when you try to use the locate command before the database is created. Normally the database is rebuilt each night by a cron job, but unless you let the machine run overnight, the database will never get built. We'll fix this problem in a little bit, but to solve the problem in the meantime, we'll run the database update program manually:
After it completes, locate should start to work. If you are unfamiliar with this wonderful utility, now is a good time to look at its man page.
If we enter the command:
linuxbox:~# locate foo
We will get back a long list of filenames containing the string "foo." Go ahead and do this. Notice how the list scrolls off the top of the screen. Next, type shift-PageUp and notice how we are able to scroll up the list. Shift-PageDown scrolls downward.
The terminal screen is only 80 characters wide but sometimes a command will output lines wider than 80 characters. This will usually cause the text to wrap but in some rare instances it will actually go off the edge of the screen. In these cases, you can scroll the screen sideways by using the shift-right arrow and shift-left arrow.
To see the next keyboard trick, type Alt-F2 and you will see a new login prompt. Actually you are seeing another virtual terminal you can log into. Go ahead and log in using your ordinary user name and password. Now try the who command:
me@linuxbox ~$ who root tty1 2009-03-04 13:49 me tty2 2009-03-04 14:28
As we can see, we have two users logged in. Type Alt-F3 and we'll see another virtual terminal. In fact, on our system, Alt-F1 through F6 provide separate terminals we can use. You can use Alt-right and left arrows to rapidly cycle through them.
Wouldn't It Be Great If The Mouse Worked?
Let's go back to the first terminal session where root is logged in by typing Alt-F1. Then start up the aptitude program:
aptitude is a fancy character based way to install packages on Debian and other Debian-based distributions. It has many features and is a handy way to manage packages on our system. The apt-get program is also available. aptitude features a multi-pane screen:
It took me a few minutes to figure out the user interface, but after installing a few packages with it, I figured it out. We're going to use aptitude to install a couple of packages. We'll use its search feature to help us out. Type / and a search prompt should appear. Enter "anacron" and it should find the package in its database.
You can use the tab key to toggle between the two display panes. With the package name highlighted, press the + key to mark the package for installation. Next, let's do another search, this time for "gpm". If it does not find it the first time, type "n" to search for the next occurrence. Repeat until it finds a package named simply gpm. This use of / (search) and n (next) is the same as the less program. Again, type + to mark the package for installation.
With our two packages selected, it's time to install them. We do this by typing "g" (for "go".) aptitude will display a summary of the actions it is about to take and by pressing "g" a second time, the installation will commence. When installing gpm for the first you will see an error message about being unable to shut down the daemon. This may be safely ignored.
When the aptitude screen returns, type "q" to quit.
We have now installed anacron, which will make sure that periodic tasks (like running updatedb) take place even if the machine is not run continuously. We also installed gpm which should make the mouse work. Some of the programs that we will install in upcoming installments can use a mouse, but its most useful feature is that we can now use the mouse to copy and paste text, just like we can on the X display. The only difference is that the right button is used to paste rather than the middle button.
You can terminate your extra terminal sessions by typing "exit" and root can shut down the machine by:
linuxbox:~# shutdown -h now
That's all for today. See you again soon!
Other installments in this series: 1 2 3 4 5 6 7 8 9 10 11 12 13 14