old-www/LDP/www.debian.org/doc/manuals/debian-tutorial/ch-start.html

720 lines
34 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Debian Tutorial (Obsolete Documentation) - Getting started</title>
<link href="index.html" rel="start">
<link href="ch-introduction.html" rel="prev">
<link href="ch-basics.html" rel="next">
<link href="index.html#contents" rel="contents">
<link href="index.html#copyright" rel="copyright">
<link href="ch-about.html" rel="chapter" title="1 About this manual">
<link href="ch-introduction.html" rel="chapter" title="2 Introduction">
<link href="ch-start.html" rel="chapter" title="3 Getting started">
<link href="ch-basics.html" rel="chapter" title="4 The Basics">
<link href="ch-docs.html" rel="chapter" title="5 Reading documentation and getting help">
<link href="ch-shell.html" rel="chapter" title="6 Using the shell">
<link href="ch-files.html" rel="chapter" title="7 More on files">
<link href="ch-editor.html" rel="chapter" title="8 Creating and editing text files">
<link href="ch-custom_shell.html" rel="chapter" title="9 Customizing the shell">
<link href="ch-X.html" rel="chapter" title="10 The X Window System">
<link href="ch-text_tools.html" rel="chapter" title="11 Text tools">
<link href="ch-file_tools.html" rel="chapter" title="12 File tools">
<link href="ch-disks.html" rel="chapter" title="13 Using disks">
<link href="ch-dpkg.html" rel="chapter" title="14 Removing and installing software">
<link href="ch-troubleshooting.html" rel="chapter" title="15 Troubleshooting">
<link href="ch-advanced.html" rel="chapter" title="16 Advanced topics">
<link href="ch-next.html" rel="chapter" title="17 Where to from here?">
<link href="ch-helping.html" rel="chapter" title="18 Contributing to Debian: How can I help?">
<link href="ap-apps_appendix.html" rel="appendix" title="A A brief survey of available applications">
<link href="ap-components_appendix.html" rel="appendix" title="B Summary of GNU/Linux system components">
<link href="ap-booting_appendix.html" rel="appendix" title="C Appendix C: Booting the system">
<link href="ap-misc_appendix.html" rel="appendix" title="D Miscellaneous">
<link href="ch-about.html#s-acknowldgements" rel="section" title="1.1 Acknowledgements">
<link href="ch-introduction.html#s-introduction-debian" rel="section" title="2.1 What is Debian?">
<link href="ch-introduction.html#s-introduction-DFSG" rel="section" title="2.2 What's free software?">
<link href="ch-introduction.html#s-introduction-how" rel="section" title="2.3 How to Read This Book">
<link href="ch-introduction.html#s-introduction-ldp" rel="section" title="2.4 The Linux Documentation Project">
<link href="ch-start.html#s-start-multi" rel="section" title="3.1 A multiuser, multitasking operating system">
<link href="ch-start.html#s-start-login" rel="section" title="3.2 Logging in">
<link href="ch-start.html#s-start-keys" rel="section" title="3.3 Keys">
<link href="ch-start.html#s-start-commandline" rel="section" title="3.4 Command history and editing the command line">
<link href="ch-start.html#s-start-root" rel="section" title="3.5 Logging in as root">
<link href="ch-start.html#s-start-VC" rel="section" title="3.6 Virtual consoles">
<link href="ch-start.html#s-start-shutdown" rel="section" title="3.7 Shutting down">
<link href="ch-basics.html#s-basics-commandline" rel="section" title="4.1 The command line and <samp>man</samp> pages">
<link href="ch-basics.html#s-basics-files" rel="section" title="4.2 Files and Directories">
<link href="ch-basics.html#s-basics-processes" rel="section" title="4.3 Processes">
<link href="ch-basics.html#s-basics-shell" rel="section" title="4.4 The shell">
<link href="ch-basics.html#s-basics-jobs" rel="section" title="4.5 Managing processes with Bash">
<link href="ch-basics.html#s-basics-bash" rel="section" title="4.6 A few Bash features">
<link href="ch-basics.html#s-basics-identity" rel="section" title="4.7 Managing your identity">
<link href="ch-docs.html#s-docs-sources" rel="section" title="5.1 Kinds of documentation">
<link href="ch-docs.html#s-docs-info" rel="section" title="5.2 Using info">
<link href="ch-docs.html#s-docs-textfiles" rel="section" title="5.3 Viewing text files with more and less">
<link href="ch-docs.html#s-docs-howtos" rel="section" title="5.4 HOWTOs">
<link href="ch-docs.html#s-docs-support" rel="section" title="5.5 Getting help from a person">
<link href="ch-docs.html#s-docs-sysinfo" rel="section" title="5.6 Getting information from the system">
<link href="ch-shell.html#s-shell-variables" rel="section" title="6.1 Environment variables">
<link href="ch-shell.html#s-shell-path" rel="section" title="6.2 Where commands live: the <samp>PATH</samp> variable">
<link href="ch-shell.html#s-custom_shell-aliases" rel="section" title="6.3 Aliases and shell functions">
<link href="ch-shell.html#s-shell-io" rel="section" title="6.4 Controlling input and output">
<link href="ch-shell.html#s-shell-modifiers" rel="section" title="6.5 Specifying how and when to run commands">
<link href="ch-shell.html#s-shell-wildcards" rel="section" title="6.6 Filename expansion (&quot;Wildcards&quot;)">
<link href="ch-shell.html#s6.7" rel="section" title="6.7 Interactive/non-interactive">
<link href="ch-files.html#s-files-permissions" rel="section" title="7.1 Permissions">
<link href="ch-files.html#s-files-tour" rel="section" title="7.2 What files are on my system? Where can I put my own files?">
<link href="ch-files.html#s-file-manager" rel="section" title="7.3 Using a filemanager">
<link href="ch-editor.html#s-editor-textfile" rel="section" title="8.1 What's a text file?">
<link href="ch-editor.html#s-editor-editor" rel="section" title="8.2 Text editors">
<link href="ch-editor.html#s-editor-vi" rel="section" title="8.3 Creating and editing a text file with <code>vi</code>">
<link href="ch-custom_shell.html#s-custom_shell-dotfiles" rel="section" title="9.1 .rc files and <samp>ls -a</samp>">
<link href="ch-custom_shell.html#s-custom_shell-etc" rel="section" title="9.2 System-wide vs. user-specific configuration">
<link href="ch-X.html#s-X-starting" rel="section" title="10.1 Starting the X environment">
<link href="ch-X.html#s-X-intro" rel="section" title="10.2 Intro: What is X">
<link href="ch-X.html#s-X-basics" rel="section" title="10.3 Basic X operations">
<link href="ch-X.html#s-X-startup" rel="section" title="10.4 Customizing your X startup">
<link href="ch-text_tools.html#s-text_tools-regexps" rel="section" title="11.1 Regular expressions">
<link href="ch-file_tools.html#s-file_tools-backup" rel="section" title="12.1 Backup tools">
<link href="ch-file_tools.html#s-file_tools-compression" rel="section" title="12.2 File compression with <samp>gzip</samp>">
<link href="ch-file_tools.html#s-file_tools-split" rel="section" title="12.3 Splitting files into smaller pieces">
<link href="ch-file_tools.html#s-file_tools-find" rel="section" title="12.4 Finding files">
<link href="ch-file_tools.html#s-file_tools-file" rel="section" title="12.5 Determining a file's contents">
<link href="ch-disks.html#s-disks-concepts" rel="section" title="13.1 Concepts">
<link href="ch-disks.html#s-disks-mount" rel="section" title="13.2 <samp>mount</samp> and <samp>/etc/fstab</samp>">
<link href="ch-disks.html#s-network-ppp" rel="section" title="13.3 PPP">
<link href="ch-dpkg.html#s-dpkg-dpkg" rel="section" title="14.1 The <code>dpkg</code> package utility">
<link href="ch-dpkg.html#s-dpkg-what" rel="section" title="14.2 What a package maintenance utility does">
<link href="ch-dpkg.html#s-dpkg-apt" rel="section" title="14.3 Apt">
<link href="ch-dpkg.html#s-dpkg-dselect" rel="section" title="14.4 Using dselect.">
<link href="ch-dpkg.html#s-dpkg-commandline" rel="section" title="14.5 Using dpkg manually">
<link href="ch-dpkg.html#s-dpkg-compiling" rel="section" title="14.6 Compiling software yourself">
<link href="ch-dpkg.html#s-dpkg-proprietary" rel="section" title="14.7 Proprietary software not in .deb format">
<link href="ch-troubleshooting.html#s-troubleshooting-frozen" rel="section" title="15.1 Debian is frozen or crashed!">
<link href="ch-troubleshooting.html#s-troubleshooting-termgarbage" rel="section" title="15.2 My terminal isn't behaving properly">
<link href="ch-troubleshooting.html#s-troubleshooting-vi" rel="section" title="15.3 The computer beeps when I press a key, and my screen shows a text file and/or a lot of <samp>~</samp> symbols.">
<link href="ch-advanced.html#s-advanced-scripting" rel="section" title="16.1 Introduction to shell scripting">
<link href="ch-advanced.html#s-advanced-files" rel="section" title="16.2 Advanced files">
<link href="ch-advanced.html#s-advanced-kernel" rel="section" title="16.3 Compiling the kernel">
<link href="ch-advanced.html#s-advanced-security" rel="section" title="16.4 A few words on security">
<link href="ch-advanced.html#s-advanced-programming" rel="section" title="16.5 Programming on Linux">
<link href="ch-next.html#s-next-manuals" rel="section" title="17.1 Other Debian manuals to read">
<link href="ch-next.html#s-next-resources" rel="section" title="17.2 Other resources">
<link href="ch-helping.html#s-helping-bugs" rel="section" title="18.1 Submit bug reports">
<link href="ch-helping.html#s-helping-other" rel="section" title="18.2 Other things">
<link href="ap-apps_appendix.html#s-A_apps-whatever" rel="section" title="A.1 (Subheadings could copy the structure of the menu system)">
<link href="ap-misc_appendix.html#s-unix-history" rel="section" title="D.1 Unix History">
<link href="ap-misc_appendix.html#sD.2" rel="section" title="D.2 GNU/Linux History">
<link href="ap-misc_appendix.html#sD.3" rel="section" title="D.3 The Linux kernel's version numbering">
<link href="ch-introduction.html#s-introduction-debian-os" rel="subsection" title="2.1.1 What's an operating system, and what sort of operating system is Debian?">
<link href="ch-introduction.html#s-introduction-debian-how" rel="subsection" title="2.1.2 Who creates Debian?">
<link href="ch-basics.html#s-basics-commandline-description" rel="subsection" title="4.1.1 Describing the command line">
<link href="ch-basics.html#s-basics-files-intro" rel="subsection" title="4.2.1 Introduction to files">
<link href="ch-basics.html#s-basics-files-using" rel="subsection" title="4.2.2 Using files: a tutorial">
<link href="ch-basics.html#s-basics-bash-completion" rel="subsection" title="4.6.1 Tab Completion">
<link href="ch-docs.html#s-docs-support-posting" rel="subsection" title="5.5.1 Dos and Don'ts of asking a question">
<link href="ch-shell.html#s-shell-variables-parents" rel="subsection" title="6.1.1 Parent and child processes">
<link href="ch-shell.html#s-interactive-shells" rel="subsection" title="6.7.1 Interactive shells">
<link href="ch-files.html#s-files-permissions-groups" rel="subsection" title="7.1.1 File Ownership">
<link href="ch-files.html#s-files-permissions-mode" rel="subsection" title="7.1.2 Mode">
<link href="ch-files.html#s-files-permissions-tutorial" rel="subsection" title="7.1.3 Permissions in practice">
<link href="ch-editor.html#s-editor-vi-creating" rel="subsection" title="8.3.1 Creating a file">
<link href="ch-editor.html#s-editor-vi-editing" rel="subsection" title="8.3.2 Editing an existing file">
<link href="ch-editor.html#s-editor-vi-editing-movement" rel="subsection" title="8.3.2.1 Moving around in a file">
<link href="ch-editor.html#s-editor-vi-editing-deletion" rel="subsection" title="8.3.2.2 Deleting text">
<link href="ch-editor.html#s-editor-vi-editing-moremoving" rel="subsection" title="8.3.2.3 Sophisticated movement">
<link href="ch-editor.html#s-editor-vi-editing-numbers" rel="subsection" title="8.3.2.4 Repeating commands">
<link href="ch-editor.html#s-editor-vi-editing-advanced" rel="subsection" title="8.3.2.5 Advanced reference">
<link href="ch-X.html#s-X-basics-mouse" rel="subsection" title="10.3.1 The mouse">
<link href="ch-X.html#s-X-basics-clients" rel="subsection" title="10.3.2 X clients">
<link href="ch-X.html#s-X-basics-trouble" rel="subsection" title="10.3.3 Troubleshooting">
<link href="ch-X.html#s-X-basics-leaving" rel="subsection" title="10.3.4 Leaving the X environment">
<link href="ch-disks.html#s-disks-mount-mounting" rel="subsection" title="13.2.1 Mounting a filesystem">
<link href="ch-disks.html#s-disks-mount-cdromexample" rel="subsection" title="13.2.2 Example: Mounting a CD-ROM">
<link href="ch-disks.html#s-disks-mount-fstab" rel="subsection" title="13.2.3 <samp>/etc/fstab</samp>: Automating the mount process">
<link href="ch-disks.html#s-disks-mount-removable" rel="subsection" title="13.2.4 Removable disks (floppies, Zip disks, etc.)">
<link href="ch-disks.html#s-network-ppp-introduction" rel="subsection" title="13.3.1 Introduction">
<link href="ch-disks.html#s-network-ppp-preparation" rel="subsection" title="13.3.2 Preparation">
<link href="ch-disks.html#s-network-ppp-wvdial" rel="subsection" title="13.3.3 The Easy Way: <samp>wvdial</samp>">
<link href="ch-disks.html#s-network-ppp-pppd" rel="subsection" title="13.3.4 Doing It Manually">
<link href="ch-dpkg.html#s-apt-config" rel="subsection" title="14.3.1 Configuring Apt">
<link href="ch-dpkg.html#s-apt-usage" rel="subsection" title="14.3.2 Using apt-get.">
<link href="ch-advanced.html#s-advanced-scripting-why" rel="subsection" title="16.1.1 What and why">
<link href="ch-advanced.html#s-advanced-scripting-example" rel="subsection" title="16.1.2 A simple example">
<link href="ch-advanced.html#s-advanced-files-hardlinks" rel="subsection" title="16.2.1 The real nature of files: hard links and inodes">
<link href="ch-advanced.html#s-advanced-files-types" rel="subsection" title="16.2.2 Types of files">
<link href="ch-advanced.html#s-advanced-files-types-symlinks" rel="subsection" title="16.2.2.1 Symbolic links">
<link href="ch-advanced.html#s-files-misc-types-devices" rel="subsection" title="16.2.2.2 Device files">
<link href="ch-advanced.html#s-advanced-files-types-devices-null" rel="subsection" title="16.2.2.2.1 <samp>/dev/null</samp>">
<link href="ch-advanced.html#s-advanced-files-types-pipes" rel="subsection" title="16.2.2.3 Named pipes (FIFOs)">
<link href="ch-advanced.html#s-advanced-files-types-sockets" rel="subsection" title="16.2.2.4 Sockets">
<link href="ch-advanced.html#s-advanced-files-proc" rel="subsection" title="16.2.3 The <samp>proc</samp> filesystem">
<link href="ch-advanced.html#s-advanced-files-permissions" rel="subsection" title="16.2.4 Advanced aspects of file permissions">
<link href="ch-advanced.html#s-advanced-files-permissions-absolute" rel="subsection" title="16.2.4.1 Using numeric arguments with <samp>chmod</samp>">
<link href="ch-advanced.html#s-advanced-files-chattr" rel="subsection" title="16.2.5 chattr">
<link href="ch-advanced.html#s-advanced-files-copying" rel="subsection" title="16.2.6 Large-scale copying">
<link href="ch-advanced.html#s-advanced-files-undocumented" rel="subsection" title="16.2.7 Other concepts not yet covered, but should be">
</head>
<body>
<p><a name="ch-start"></a></p>
<hr>
<p>
[ <a href="ch-introduction.html">previous</a> ]
[ <a href="index.html#contents">Contents</a> ]
[ <a href="ch-about.html">1</a> ]
[ <a href="ch-introduction.html">2</a> ]
[ 3 ]
[ <a href="ch-basics.html">4</a> ]
[ <a href="ch-docs.html">5</a> ]
[ <a href="ch-shell.html">6</a> ]
[ <a href="ch-files.html">7</a> ]
[ <a href="ch-editor.html">8</a> ]
[ <a href="ch-custom_shell.html">9</a> ]
[ <a href="ch-X.html">10</a> ]
[ <a href="ch-text_tools.html">11</a> ]
[ <a href="ch-file_tools.html">12</a> ]
[ <a href="ch-disks.html">13</a> ]
[ <a href="ch-dpkg.html">14</a> ]
[ <a href="ch-troubleshooting.html">15</a> ]
[ <a href="ch-advanced.html">16</a> ]
[ <a href="ch-next.html">17</a> ]
[ <a href="ch-helping.html">18</a> ]
[ <a href="ap-apps_appendix.html">A</a> ]
[ <a href="ap-components_appendix.html">B</a> ]
[ <a href="ap-booting_appendix.html">C</a> ]
[ <a href="ap-misc_appendix.html">D</a> ]
[ <a href="ch-basics.html">next</a> ]
</p>
<hr>
<h1>
Debian Tutorial (Obsolete Documentation)
<br>Chapter 3 - Getting started
</h1>
<hr>
<p>
So you've just finished installing Debian! Congratulations. Dive right in and
start learning to use it.
</p>
<p>
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 <samp>Alt</samp> key at the LILO prompt and selecting
Linux).
</p>
<hr>
<h2><a name="s-start-multi"></a>3.1 A multiuser, multitasking operating system</h2>
<p>
As we mentioned earlier (<a
href="ch-introduction.html#s-introduction-debian">What is Debian?, Section
2.1</a>), 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 <em>multiuser</em> systems.
</p>
<p>
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 <em>terminal</em> [<a href="footnotes.html#f1" name="fr1">1</a>]. To
permit many users to work at once, Debian must permit many programs and
applications to run simultaneously. This feature is called
<em>multitasking</em>.
</p>
<p>
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.
</p>
<p>
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.
</p>
<hr>
<h2><a name="s-start-login"></a>3.2 Logging in</h2>
<p>
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.
</p>
<p>
To this end, you have a <em>user name</em> or <em>login</em> --- 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.
</p>
<p>
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 href="ch-advanced.html#s-advanced-security">A few words on
security, Section 16.4</a>). If you're worried about security, you should have
a password.
</p>
<p>
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.
</p>
<p>
When you start Debian, you'll see a <em>prompt</em>; a request from the
computer for some information. In this case, the prompt is
<samp>login:</samp>.
</p>
<p>
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 <samp>Enter</samp> after
both the username and the password. If you type your username or password
incorrectly, you'll have to start over.
</p>
<p>
If you do it correctly, you'll see a brief message and then a <samp>$</samp>
prompt. The <samp>$</samp> is printed by a special program called the
<em>shell</em>, and is thus called a <em>shell prompt</em>: this is where you
give commands to the system.
</p>
<p>
Try entering the command <samp>whoami</samp> now. There is a <em>cursor</em>
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 <samp>RET</samp> (the Enter or Return key) when you're done typing
a shell command.
</p>
<p>
<samp>whoami</samp> tells your username. You'll then get a new shell prompt.
</p>
<p>
For the rest of the manual, when we say to enter a command, you should type it
at the shell prompt and press the <samp>RET</samp> key. On some keyboards,
this key is labeled <samp>Enter</samp> and on others it's <samp>Return</samp>.
Same key, different name.
</p>
<p>
When you're done working, you may want to log out of the system. To exit the
shell, enter the <samp>exit</samp> 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.
</p>
<hr>
<h2><a name="s-start-keys"></a>3.3 Keys</h2>
<p>
Before going on, it's important to be familiar with the conventions in this
manual for describing key commands.
</p>
<p>
When you should simultaneously hold down multiple keys, a notation like
<samp>C-a</samp> will be used. This means &quot;hold the control key, and type
lowercase letter a.&quot; Other abbreviations include the Alt key,
<samp>A</samp>, and the Meta key <samp>M</samp>. 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.
</p>
<p>
Keys like Alt and Meta are called <em>modifier</em> 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, <samp>M-C-a</samp> means to
simultaneously press Meta, Ctrl, and lowercase a.
</p>
<p>
Some keys have a special notation; for example, <samp>RET</samp>
(Return/Enter), <samp>DEL</samp> (Delete or sometimes Backspace),
<samp>ESC</samp> (Escape). These should be fairly self-explanatory.
</p>
<p>
Spaces instead of hyphens mean to type the keys in sequence. So, for example,
<samp>C-a x RET</samp> means to simultaneously type Control and lowercase a,
followed by the letter x, followed by pressing Return.
</p>
<hr>
<h2><a name="s-start-commandline"></a>3.4 Command history and editing the command line</h2>
<p>
Whatever you type after the shell prompt before pressing <samp>RET</samp> is
called a <em>command line</em> --- 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.
</p>
<p>
You can scroll up to previous commands to run them again, or modify them
slightly and <em>then</em> run them again. Try this: enter any command, such
as <samp>whoami</samp>; then press the up arrow key. The <samp>whoami</samp>
command will reappear at the prompt. You can then press <samp>RET</samp> to
run <samp>whoami</samp> a second time.
</p>
<p>
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.
</p>
<p>
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 <samp>whoasmi</samp>
instead of <samp>whoami</samp>, then use the left arrow key to move back to the
<samp>s</samp>. You can erase the <samp>s</samp> with the Backspace or Delete
keys.
</p>
<p>
There are more advanced features as well (no need to memorize them all now,
though). Try typing <samp>C-a</samp>. This moves you to the beginning of the
line. <samp>C-k</samp> (the <samp>k</samp> stands for &quot;kill&quot;)
deletes until the end of the line --- try it from the middle of the command
line. Using <samp>C-a</samp> followed by <samp>C-k</samp>, you can delete the
entire command line. <samp>C-y</samp> pastes the last thing you killed,
inserting it at the current cursor position (<samp>y</samp> stands for
&quot;yank,&quot; as in &quot;yank it back&quot;). <samp>C-e</samp> will move
the cursor at the end of the command line.
</p>
<p>
Go ahead and play around with command line editing to get a feel for it.
Experiment.
</p>
<hr>
<h2><a name="s-start-root"></a>3.5 Logging in as root</h2>
<p>
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.
</p>
<p>
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 <em>root user</em> (also called the <em>superuser</em>).
</p>
<p>
To become root, just log on with the username <samp>root</samp> 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. [<a
href="footnotes.html#f2" name="fr2">2</a>]
</p>
<p>
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, <em>you</em> 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.
</p>
<p>
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.
</p>
<p>
If you have the password, try logging on as root now. Enter the
<samp>whoami</samp> command to verify your identity. Then <em>log out
immediately</em>. 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 <samp>rm -rf /</samp> and erase your <em>entire
system</em> in a few keystrokes. (Needless to say, you should <em>NOT</em>
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.
</p>
<p>
You may find the <code>su</code> command more convenient than logging in as
root. <code>su</code> allows you to assume the identity of another user,
usually root unless you specify someone else. (You can remember that
<code>su</code> stands for Super User, though some say it stands for Set
UserID.)
</p>
<p>
Try this:
</p>
<ol type="1" start="1" >
<li>
<p>
Log on as yourself, i.e. not as root.
</p>
</li>
</ol>
<ol type="1" start="2" >
<li>
<p>
<samp>whoami</samp>
</p>
<p>
Confirm your username.
</p>
</li>
</ol>
<ol type="1" start="3" >
<li>
<p>
<samp>su</samp>
</p>
<p>
Enter the <samp>su</samp> 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 <samp>#</samp> rather than
<samp>$</samp>.
</p>
</li>
</ol>
<ol type="1" start="4" >
<li>
<p>
<samp>whoami</samp>
</p>
<p>
This should give &quot;root&quot; as your new username.
</p>
</li>
</ol>
<ol type="1" start="5" >
<li>
<p>
<samp>exit</samp>
</p>
<p>
Exit the root shell. Your prompt will return to <samp>$</samp>.
</p>
</li>
</ol>
<ol type="1" start="6" >
<li>
<p>
<samp>exit</samp>
</p>
<p>
Exit your own shell.
</p>
</li>
</ol>
<p>
When you're doing system administration tasks, you should do as much as
possible as yourself. Then <samp>su</samp>, do the part that requires root
privileges, and <samp>exit</samp> to turn off privileges so you can no longer
harm anything.
</p>
<p>
You can use <samp>su</samp> to assume the identity of any user on the system,
not just root. To do this, type <samp>su <var>user</var></samp> where
<var>user</var> 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.
</p>
<hr>
<h2><a name="s-start-VC"></a>3.6 Virtual consoles</h2>
<p>
The Linux kernel supports <em>virtual consoles</em>. 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 &quot;hot keys&quot; for switching among the
consoles quickly. To try it, log in to your system, and type <samp>A-F2</samp>
(simultaneously press the <samp>Alt</samp> key, and <samp>F2</samp>, that is,
function key number 2).
</p>
<p>
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
<samp>whoami</samp>'s or whatever --- to confirm that this is a real login
shell. Now you can return to virtual console number 1, with <samp>A-F1</samp>.
Or you can move on to a <em>third</em> virtual console, in the obvious way
(<samp>A-F3</samp>).
</p>
<p>
Debian comes with six virtual consoles enabled by default, accessed with the
Alt key and function keys <samp>F1-F6</samp> (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).
</p>
<p>
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 <samp>Ctrl</samp> to the
key sequence. So that's <samp>C-A-F1</samp> to get to VC 1. But you can go
from a text VC to the X virtual console using only <samp>Alt</samp>. 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.
</p>
<p>
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.
</p>
<hr>
<h2><a name="s-start-shutdown"></a>3.7 Shutting down</h2>
<p>
<em>Do not just turn off the computer! You risk losing valuable data!</em>
</p>
<p>
If you are the only user of your computer, you might want to turn the computer
off when you're done with it. [<a href="footnotes.html#f3" name="fr3">3</a>]
</p>
<p>
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 <em>disk cache</em>. 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 <em>syncing</em>. 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.
</p>
<p>
To reboot, just type <samp>reboot</samp>, or press <samp>C-A-DEL</samp> (that's
Control, Alt, and Delete).
</p>
<p>
To shut down, you'll have to be <samp>root</samp>. As root, just type the
command <samp>shutdown -h now</samp>. This will go through the entire shutdown
procedure, including the <samp>sync</samp> command which clears the disk cache
as described above. When you see <samp>System halted</samp>, 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.
</p>
<p>
Some people find it simplest to shut down by typing <samp>C-A-DEL</samp> 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.
</p>
<hr>
<p>
[ <a href="ch-introduction.html">previous</a> ]
[ <a href="index.html#contents">Contents</a> ]
[ <a href="ch-about.html">1</a> ]
[ <a href="ch-introduction.html">2</a> ]
[ 3 ]
[ <a href="ch-basics.html">4</a> ]
[ <a href="ch-docs.html">5</a> ]
[ <a href="ch-shell.html">6</a> ]
[ <a href="ch-files.html">7</a> ]
[ <a href="ch-editor.html">8</a> ]
[ <a href="ch-custom_shell.html">9</a> ]
[ <a href="ch-X.html">10</a> ]
[ <a href="ch-text_tools.html">11</a> ]
[ <a href="ch-file_tools.html">12</a> ]
[ <a href="ch-disks.html">13</a> ]
[ <a href="ch-dpkg.html">14</a> ]
[ <a href="ch-troubleshooting.html">15</a> ]
[ <a href="ch-advanced.html">16</a> ]
[ <a href="ch-next.html">17</a> ]
[ <a href="ch-helping.html">18</a> ]
[ <a href="ap-apps_appendix.html">A</a> ]
[ <a href="ap-components_appendix.html">B</a> ]
[ <a href="ap-booting_appendix.html">C</a> ]
[ <a href="ap-misc_appendix.html">D</a> ]
[ <a href="ch-basics.html">next</a> ]
</p>
<hr>
<p>
Debian Tutorial (Obsolete Documentation)
</p>
<address>
29 Dezember 2009<br>
<br>
Havoc Pennington <code><a href="mailto:hp@debian.org">hp@debian.org</a></code><br>
<br>
</address>
<hr>
</body>
</html>