Chapter 8 The Shell

Table of Contents
8.1 Users
8.2 The Command Line
8.3 The Bourne Again Shell (bash)
8.4 Virtual Terminals

In a graphical environment, the interface is provided by a program that creates windows, scrollbars, menus, etc. In a commandline environment, the user interface is provided by a shell, which interprets commands and generally makes things useable. Immediately after logging in (which is covered in this chapter), users are put into a shell and allowed to go about their business. This chapter serves as an introduction to the shell, and to the most common shell among Linux users-- the Bourne Again Shell (bash). For more detailed information on anything in this chapter, check out the bash(1) man page.

8.1 Users

8.1.1 Logging In

So you've booted, and you're looking at something that looks like this:

Welcome to Linux 2.4.18
Last login: Wed Jan   1 15:59:14 -0500 2005 on tty6.
darkstar login:

Hmm.. nobody said anything about a login. And what's a darkstar? Don't worry; you probably didn't accidentally fire up a hyperspace comm-link to the Empire's artificial moon. (I'm afraid the hyperspace comm-link protocol isn't currently supported by the Linux kernel. Maybe the 2.8 kernel branch will at last provide this oft looked-for support.) No, darkstar is just the name of one of our computers, and its name gets stamped on as the default. If you specified a name for your computer during setup, you should see it instead of darkstar.

As for the login... If this is your first time, you'll want to log in as root. You'll be prompted for a password; if you set one during the setup process, that's what it's looking for. If not, just hit enter. That's it-- you're in!

8.1.2 Root: The Superuser

Okay, who or what is root? And what's it doing with an account on your system?

Well, in the world of Unix and similar operating systems (like Linux), there are users and then there are users. We'll go into this in more detail later, but the important thing to know now is that root is the user above all users; root is all-powerful and all-knowing, and nobody disobeys root. It just isn't allowed. root is what we call a “superuser”, and rightly so. And best of all, root is you.

Cool, huh?

If you're not sure: yes, that's very cool. The catch is, though, that root is inherently allowed to break anything it so desires. You might want to skip ahead to Section 12.1.1 and see about adding a user; then login as that user and work from there. The traditional wisdom is that it's best to only become the superuser when absolutely necessary, so as to minimize the possibility of accidentally breaking something.

By the way, if you decide you want to be root while you're logged in as someone else, no problem. Just use the su(1) command. You'll be asked for root's password and then it will make you root until you exit or logout. You can also become any other user using su, provided you know that user's password: su logan, for instance, would make you me.


root is allowed to su to any user, without requiring their password.