[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ 15 ] [ 16 ] [ 17 ] [ 18 ] [ A ] [ B ] [ C ] [ D ] [ next ]

Debian Tutorial (Obsolete Documentation)
Chapter 3 - Getting started

So you've just finished installing Debian! Congratulations. Dive right in and start learning to use it.

As a part of the install process, you should have figured out how to boot the Debian system (with a special floppy disk, by simply turning your computer on, or by holding down the Alt key at the LILO prompt and selecting Linux).

3.1 A multiuser, multitasking operating system

As we mentioned earlier (What is Debian?, Section 2.1), the design of Debian GNU/Linux comes from the Unix operating system. Unlike common desktop OS's such as DOS, Windows, and MacOS, Unix is usually found on large servers and multiuser systems.

This means that Debian has features those other OS's lack. It allows a large number of people to use the same computer at once, as long as each user has their own terminal [1]. To permit many users to work at once, Debian must permit many programs and applications to run simultaneously. This feature is called multitasking.

Much of the complexity (and power) of Unix-like systems stems from these two features. For example, the system must have a way to keep users from accidentally deleting each other's files, and it has to coordinate the many programs running at once, e.g. to ensure that they don't all use the hard drive at the same time.

If you keep in mind what Debian was originally designed to do, many aspects of it will make a lot more sense. You'll learn to take advantage of the power of these features.

3.2 Logging in

To use Debian you must identify yourself to the system. This is so it knows who you are, what you have permission to do, and what your preferences are.

To this end, you have a user name or login --- if you installed Debian yourself, you should have been asked to give such a name during installation. If you are logging on to a system administered by someone else, you'll have to ask them for an account on the system, and a corresponding username.

You also have a password, so no one else can pretend to be you. If you don't have a password, anyone can log on to your computer from the Internet, and do bad things (see A few words on security, Section 16.4). If you're worried about security, you should have a password.

Many people prefer to trust others not to do anything malicious with their account; hopefully your work environment doesn't encourage paranoia. This is a perfectly reasonable attitude; it depends on your personal priorities, and your environment. Obviously a home system does not need to be as secure as a military installation. Debian allows you to be as secure or as insecure as you like.

When you start Debian, you'll see a prompt; a request from the computer for some information. In this case, the prompt is login:.

You should enter your username, and when requested, your password. The password does not appear on the screen as you type it --- that's so no one can look over your shoulder and see what it is. Press Enter after both the username and the password. If you type your username or password incorrectly, you'll have to start over.

If you do it correctly, you'll see a brief message and then a $ prompt. The $ is printed by a special program called the shell, and is thus called a shell prompt: this is where you give commands to the system.

Try entering the command whoami now. There is a cursor to the right of the shell prompt. Your cursor is a small underscore or rectangle which indicates where you're typing; it should move as you type. Always press RET (the Enter or Return key) when you're done typing a shell command.

whoami tells your username. You'll then get a new shell prompt.

For the rest of the manual, when we say to enter a command, you should type it at the shell prompt and press the RET key. On some keyboards, this key is labeled Enter and on others it's Return. Same key, different name.

When you're done working, you may want to log out of the system. To exit the shell, enter the exit command. Keep in mind that if you remain logged in, someone could come along and use your account. Hopefully you can trust those in your office or home not to do this; but if you do not trust your environment, you should be certain to log out when you leave.

3.3 Keys

Before going on, it's important to be familiar with the conventions in this manual for describing key commands.

When you should simultaneously hold down multiple keys, a notation like C-a will be used. This means "hold the control key, and type lowercase letter a." Other abbreviations include the Alt key, A, and the Meta key M. Some keyboards have both Alt and Meta; most home computers have only Alt, but the Alt key behaves like a Meta key. So if you have no Meta key, try the Alt key instead.

Keys like Alt and Meta are called modifier keys because they change the meaning of standard keys like the letter A. Sometimes you need to hold down more than one modifier; for example, M-C-a means to simultaneously press Meta, Ctrl, and lowercase a.

Some keys have a special notation; for example, RET (Return/Enter), DEL (Delete or sometimes Backspace), ESC (Escape). These should be fairly self-explanatory.

Spaces instead of hyphens mean to type the keys in sequence. So, for example, C-a x RET means to simultaneously type Control and lowercase a, followed by the letter x, followed by pressing Return.

3.4 Command history and editing the command line

Whatever you type after the shell prompt before pressing RET is called a command line --- it's a line of text that commands the computer to do something. The Debian default shell offers several features to make entering command lines easy.

You can scroll up to previous commands to run them again, or modify them slightly and then run them again. Try this: enter any command, such as whoami; then press the up arrow key. The whoami command will reappear at the prompt. You can then press RET to run whoami a second time.

If you've entered several commands, you can keep pressing the up arrow key to go back through them. This feature is handy if you're doing the same thing several times, or if you type a command incorrectly and want to go back to fix it. You can press the down arrow key to move in the other direction, toward your more recent commands. If there are no more commands to move to, the computer will beep.

You can also move around on the command line to make changes. The easiest way is with the left and right arrow keys --- try typing whoasmi instead of whoami, then use the left arrow key to move back to the s. You can erase the s with the Backspace or Delete keys.

There are more advanced features as well (no need to memorize them all now, though). Try typing C-a. This moves you to the beginning of the line. C-k (the k stands for "kill") deletes until the end of the line --- try it from the middle of the command line. Using C-a followed by C-k, you can delete the entire command line. C-y pastes the last thing you killed, inserting it at the current cursor position (y stands for "yank," as in "yank it back"). C-e will move the cursor at the end of the command line.

Go ahead and play around with command line editing to get a feel for it. Experiment.

3.5 Logging in as root

Since Debian is a multiuser system, it's designed to keep any one user or program from breaking the entire system. The kernel will not allow normal users to change important system files. This means that things stay the way they're supposed to, safe from accidents, viruses, and even malicious pranks. Unlike other operating systems, Debian is safe from these threats. You won't need an antivirus program.

However, sometimes you need to change important system files --- for example, you might want to install new software, or configure your network connection. To do so, you have to have greater powers than a normal user; you must become the root user (also called the superuser).

To become root, just log on with the username root and the root password, if you have it. Hopefully you remember the password from when you installed the system --- if not, you have a problem. [2]

At many sites, only the system administrator has the root password, and only the system administrator can do the things that one must be root to do. If you're using your own personal computer, you are the system administrator, of course. If you don't have root privileges, you will have to rely on your system administrator to perform any tasks that require root privileges.

Sometimes you'll have the root password even on a shared corporate or educational server, because the sysadmin trusts you to use it properly. In that case, you'll be able to help administer the system and customize it for your needs. But you should be sure to use the password responsibly, respecting other users at all times.

If you have the password, try logging on as root now. Enter the whoami command to verify your identity. Then log out immediately. When you're root, the kernel will not protect you from yourself, because root has permission to do anything at all to the system. For example, you can type rm -rf / and erase your entire system in a few keystrokes. (Needless to say, you should NOT type this). Don't experiment while you're root. In fact, don't do anything as root, unless absolutely necessary. This isn't a matter of security, but rather of stability. Your system will run much better if it can keep you from making silly mistakes.

You may find the su command more convenient than logging in as root. su allows you to assume the identity of another user, usually root unless you specify someone else. (You can remember that su stands for Super User, though some say it stands for Set UserID.)

Try this:

  1. Log on as yourself, i.e. not as root.

  1. whoami

    Confirm your username.

  1. su

    Enter the su command. It will prompt for a password; enter the root password. If you give the correct password, you should see a new shell prompt. By default, root's shell prompt is # rather than $.

  1. whoami

    This should give "root" as your new username.

  1. exit

    Exit the root shell. Your prompt will return to $.

  1. exit

    Exit your own shell.

When you're doing system administration tasks, you should do as much as possible as yourself. Then su, do the part that requires root privileges, and exit to turn off privileges so you can no longer harm anything.

You can use su to assume the identity of any user on the system, not just root. To do this, type su user where user is the user you want to become. You'll have to know their password, of course, unless you're root at the time or they have no password.

3.6 Virtual consoles

The Linux kernel supports virtual consoles. These are a way of making your single screen and keyboard seem like multiple terminals, all connected to the same system. Thankfully, using virtual consoles is one of the simplest things about Debian: there are "hot keys" for switching among the consoles quickly. To try it, log in to your system, and type A-F2 (simultaneously press the Alt key, and F2, that is, function key number 2).

You should find yourself at another login prompt. Don't panic: you are now on virtual console (VC) number 2! Log in here and do some things --- more whoami's or whatever --- to confirm that this is a real login shell. Now you can return to virtual console number 1, with A-F1. Or you can move on to a third virtual console, in the obvious way (A-F3).

Debian comes with six virtual consoles enabled by default, accessed with the Alt key and function keys F1-F6 (technically, there are more virtual consoles enabled, but only 6 of them allow you to log in. The others are used for the X Window System or other special purposes).

If you're using the X Window System, it will generally start up on the first unused virtual console --- probably VC 7. Also, to switch from the X virtual console to one of the first six, you'll have to add Ctrl to the key sequence. So that's C-A-F1 to get to VC 1. But you can go from a text VC to the X virtual console using only Alt. If you never leave X, you won't have to worry about this; X automatically switches you to its virtual console when it starts up.

Once you get used to them, virtual consoles will probably become an indispensable tool for getting many things done at once. (The X Window System serves much the same purpose, providing multiple windows rather than multiple consoles). You can run a different program on each VC or log on as root on one VC and as yourself on another. Or everyone in the family can use their own VC --- this is especially handy if you use X, in which case you can run several X sessions at once, on different virtual consoles.

3.7 Shutting down

Do not just turn off the computer! You risk losing valuable data!

If you are the only user of your computer, you might want to turn the computer off when you're done with it. [3]

Unlike most versions of DOS, it's a bad thing to just hit the power switch when you're done using the computer. It is also bad to reboot the machine (with the reset button) without first taking proper precautions. The Linux kernel, in order to improve performance, has a disk cache. This means it temporarily stores information meant for permanent storage in RAM: since memory is thousands of times faster than a disk, this makes many file operations move more quickly. Periodically, the information Linux has in memory is actually written to the disk. This is called syncing. In order to turn off or reboot the computer, you'll have to tell the computer to clear everything out of memory and put it in permanent storage.

To reboot, just type reboot, or press C-A-DEL (that's Control, Alt, and Delete).

To shut down, you'll have to be root. As root, just type the command shutdown -h now. This will go through the entire shutdown procedure, including the sync command which clears the disk cache as described above. When you see System halted, it's safe to turn off the computer. If you have Advanced Power Management (APM) support in your kernel and BIOS, the computer might shut itself off and save you the trouble. APM is common in laptops and is also found in certain desktop mainboards.

Some people find it simplest to shut down by typing C-A-DEL to reboot, then powering off the computer before the Linux kernel begins to reload. However, once the kernel begins to load, you have to wait for it to finish and then properly reboot or shutdown again.

[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ 15 ] [ 16 ] [ 17 ] [ 18 ] [ A ] [ B ] [ C ] [ D ] [ next ]

Debian Tutorial (Obsolete Documentation)

29 Dezember 2009

Havoc Pennington hp@debian.org