[ edellinen ] [ Sisällys ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ 15 ] [ A ] [ seuraava ]

Luku 4 - Debian tutorials

This section provides a basic orientation to the Debian world for the real newbie. If you have been using any Unix-like system for a while, you probably know everything I explained here. Please use this as a reality check.

4.1 Getting started

After the installation of the Debian system on your PC, you need to learn few things to make it useful. Let us give you an express training.

4.1.1 Login to a shell prompt as root

Upon rebooting the system, you will be presented either the graphical login screen or the character based login screen depending on your initial selection of packages. For the sake of simplicity, if you are presented with the graphical login screen, press Ctrl-Alt-F1 [3] to gain the character based login screen.

Suppose your hostname is foo, the login prompt looks like:

     foo login:

Type root , press the Enter-key and type the password which you selected during the install process. In the Debian system, following the Unix tradition, the password is case sensitive. Then the system starts with the greeting message and presents you with the root command prompt waiting for your input. [4]

     foo login: root
     Last login: Sun Oct 26 19:04:09 2003 on tty3
     Linux foo 2.4.22-1-686 #6 Sat Oct 4 14:09:08 EST 2003 i686 GNU/Linux
     Most of the programs included with the Debian GNU/Linux system are
     freely redistributable; the exact distribution terms for each program
     are described in the individual files in /usr/share/doc/*/copyright
     Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
     permitted by applicable law.

You are ready to perform the system administration from this root command prompt. This root account is also called superuser or privileged user. From this account, you can do anything:

It is extremely bad idea to share the access to the root account by sharing the password. Use of program such as sudo(8) is the good way to share the administrative privileges.

Please note that it is considered a good Unix habit to login to the non-privileged user account first even when you plan to perform administrative activities. Use commands sudo, super, or su -c to gain the limited root privileged when needed. See Working more safely – sudo, Kohta 9.2.4. [5]

4.1.2 Set up minimal newbie environment

I think learning a computer system is like learning a new foreign language. Although tutorial books are helpful, you have to practice it with helper tools. In this context, I think it is a good idea to install few additional packages such as mc, vim, lynx, doc-linux-text, and debian-policy. [6]

     # apt-get update
     # apt-get install mc vim lynx doc-linux-text debian-policy 

If you already had these packages installed, nothing will be installed.

4.1.3 Add a user account

During the installation, you usually created a non-privileged user account who receives e-mails sent to the root account. [7] Since you do not want to use this special user account for the following training activities either, you should create another new user account.

Suppose you wish this new username to be penguin, type:

     root@foo:root# adduser penguin
     ... answer all the questions

will create it. [8] Before going further, let's learn few things first.

4.1.4 Switch between virtual console

In the default Debian system, there are six independent pseudo-terminals available, i.e., you can use the PC's VGA character console screen as 6 switchable VT-100 terminals. Switch from one to another by pressing the Left-Alt-key and one of the F1–F6 keys simultaneously. Each pseudo-terminal allows independent login to accounts. The multiuser environment is a great Unix feature, and very addictive.

If you accidentally typed Alt-F7 on a system running the X Window System and the console screen displays graphic screen, regain the access to the character console by pressing Ctrl-Alt-F1. Just try to move to different console and come back to the original one to get used to this.

4.1.5 How to shut down

Just like any other modern OSs where the file operation involves caching data in the memory, the Debian system needs the proper shutdown procedure before power can safely be turned off to maintain the integrity of files. Use the following command from the root command prompt to shutdown the system:

     # shutdown -h now

This is for the normal multiuser mode. If you are in the single-user mode, use following from the root command prompt:

     # poweroff -i -f

Alternatively, you may type Ctrl-Alt-Delete to shutdown. [9]

Wait until the system displays "System halted" then shut off power. If the APM or ACPI function has been turned on by the BIOS and Linux properly, the system will power down by itself. See Large memory and auto power-off, Kohta 3.8.4 for the detail.

4.1.6 Play time

Now you are ready to play with the Debian system without risks as long as you use this non-privileged user account penguin. [10]

Let's login to the penguin. If you are at root shell prompt, type Ctrl-D [11] at the root command prompt to close the root shell activity and return to the login prompt. Enter your newly created username penguin and the corresponding password. [12] You will be presented with the following command prompt.


From here on, the example given will use simplified command prompt for the sake of simplicity. I will use:

We will start learning the Debian system first with the easy way Midnight Commander (MC), Kohta 4.2 and later with the proper way Unix-like work environment, Kohta 4.3.

4.2 Midnight Commander (MC)

Midnight Commander (MC) is a GNU "Swiss army knife" for the Linux console and other terminal environments. This gives newbie a menu driven console experience which is much easier to learn than standard Unix commands.

Use this command to explore the Debian system. This is the best way to learn. Please explore few key locations just using the cursor keys and Enter key:

4.2.1 Enhance MC

In order to make MC to change working directory upon exit, you need to modify ~/.bashrc (or /etc/bash.bashrc, called from .bashrc), as detailed in its manual page, mc(1), under the -P option. [13]

4.2.2 Start MC

     $ mc

MC takes care of all file operations through its menu, requiring minimal user effort. Just press F1 to get the help screen. You can play with MC just by pressing cursor-keys and function-keys. [14]

4.2.3 File manager in MC

The default is two directory panels containing file lists. Another useful mode is to set the right window to "information" to see file access privilege information, etc. Following are some essential keystrokes. With the gpm daemon running, one can use a mouse, too. (Make sure to press the shift-key to obtain the normal behavior of cut and paste in MC.)

4.2.4 Command-line tricks in MC

4.2.5 Editor in MC

The internal editor has an interesting cut-and-paste scheme. Pressing F3 marks the start of a selection, a second F3 marks the end of selection and highlights the selection. Then you can move your cursor. If you press F6, the selected area will be moved to the cursor location. If you press F5, the selected area will be copied and inserted at the cursor location. F2 will save the file. F10 will get you out. Most cursor keys work intuitively.

This editor can be directly started on a file:

     $ mc -e filename_to_edit
     $ mcedit filename_to_edit

This is not a multi-window editor, but one can use multiple Linux consoles to achieve the same effect. To copy between windows, use Alt-Fn keys to switch virtual consoles and use "File->Insert file" or "File->Copy to file" to move a portion of a file to another file.

This internal editor can be replaced with any external editor of choice.

Also, many programs use environment variables EDITOR or VISUAL to decide which editor to use. If you are uncomfortable with vim, set these to mcedit by adding these lines to ~/.bashrc:

     export EDITOR=mcedit
     export VISUAL=mcedit

I do recommend setting these to vim if possible. Getting used to vim commands is the right thing to do, since Vi-editor is always there in the Linux/Unix world. [15]

4.2.6 Viewer in MC

Very smart viewer. This is a great tool for searching words in documents. I always use this for files in the /usr/share/doc directory. This is the fastest way to browse through masses of Linux information. This viewer can be directly started like so:

     $ mc -v filename_to_view

4.2.7 Auto-start features of MC

Press Enter on a file, and the appropriate program will handle the content of the file. This is a very convenient MC feature.

     executable file:   Execute command
     man, html file:    Pipe content to viewer software
     tar.gz, deb file:  Browse its contents as if subdirectory

In order to allow these viewer and virtual file features to function, viewable files should not be set as executable. Change their status using the chmod command or via the MC file menu.

4.2.8 FTP virtual filesystem of MC

MC can be used to access files over the Internet using FTP. Go to the menu by pressing F9, then type `p' to activate the FTP virtual filesystem. Enter a URL in the form username:passwd@hostname.domainname, which will retrieve a remote directory that appears like a local one.

Try http.us.debian.org/debian as URL and browse Debian file archive. See Debian-arkistot, Kohta 2.1 for how these are organized.

4.3 Unix-like work environment

Although MC enables you to do almost everything, it is very important for you to learn how to use the command line tools invoked from the shell prompt and become familiar with the Unix-like work environment. [16]

4.3.1 Special key strokes

In the Unix-like environment, there are few key strokes which have special meanings. [17]

The default shell, bash, has history-editing and tab-completion capabilities to aide the interactive use.

Other important keystrokes to remember:

Here, in order to use a mouse in the Linux character console, you need to have gpm running as daemon. [19] See Mouse configuration, Kohta 3.3.

4.3.2 Basic Unix commands

Let's learn the basic Unix commands. [20] Try all the following commands from the non-privileged user account penguin :

Please traverse directories and peek into the system using above commands as a training. If you have questions on any of the console commands, please make sure to read the manual page. For example, these commands are the good start:

     $ man man
     $ man bash
     $ man ls

Also this is a good timing to start vim and press F1-key. You should at least read the first 35 lines. Then do the online training course by moving cursor to |tutor| and pressing Ctrl-]. See Editors, Luku 11 to learn more about editors.

Please note that many Unix-like commands including ones from GNU and BSD will display brief help information if you invoke them in one of the following ways (or without any arguments in some cases):

     $ commandname --help
     $ commandname -h

Try also examples in Debian tips, Luku 8 as your self training.

4.3.3 The command execution

Now you have some feel on how to use the Debian system. Let's look deep into the mechanism of the command execution in the Debian system. [27]

4.3.4 Simple command

A simple command is a sequence of

  • variable assignments (optional)

  • command name

  • arguments (optional)

  • redirections (optional: > , >> , < , << , etc.)

  • control operator (optional: && , || ; <newline> , ; , & , ( , ) )

  • For more complex commands with quotations and substitutions, see Command-line processing, Kohta 13.2.6.

    4.3.5 Command execution and environment variable

    Typical command execution uses a shell line sequence like the following: [28]

         $ date
         Sun Oct 26 08:17:20 CET 2003
         $ LC_ALL=fr_FR date
         dim oct 26 08:17:39 CET 2003

    Here, the program date is executed in the foreground job. The environment variable LC_ALL is:

    Most command executions usually do not have preceding environment variable definition. For the above example, you can alternatively execute:

         $ LC_ALL=fr_FR
         $ date
         dim oct 26 08:17:39 CET 2003

    As you can see here, the output of command is affected by the environment variable to produce French output. If you want the environment variable to be inherited to the subprocesses (e.g., when calling shell script), you need to "export" it instead by using:

         $ export LC_ALL

    4.3.6 Command search path

    When you type a command into the shell, the shell searches the command in the list of directories contained in the PATH environment variable. The value of the PATH environment variable is also called the shell's search path.

    In the default Debian installation, the PATH environment variable of user accounts may not include /sbin/. So if you want to run any commands such as ifconfig from /sbin/, you must change the PATH environment variable to include it. The PATH environment variable is usually set by the initialization file ~/.bash_profile, see Bash configuration, Kohta 3.2.

    4.3.7 Command line options

    Some commands take arguments. The arguments starting with - or -- are called options and control the behavior of the command.

         $ date
         Mon Oct 27 23:02:09 CET 2003
         $ date -R
         Mon, 27 Oct 2003 23:02:40 +0100

    Here the command-line argument -R changes the date command behavior to output RFC-2822 compliant date string.

    4.3.8 Shell wildcards

    Often you want a command to work with a group of files without typing all of them. The filename expansion pattern using the shell wildcards facilitate this needs.

    For example, try the following and think yourself:

         $ mkdir junk; cd junk; touch 1.txt 2.txt 3.c 4.h .5.txt
         $ echo *.txt
         1.txt 2.txt
         $ echo *
         1.txt 2.txt 3.c 4.h
         $ echo *.[hc]
         3.c 4.h
         $ echo .*
         . .. .5.txt
         $ echo .[^.]*
         $ echo [^1-3]*
         $ cd ..; rm -rf junk

    4.3.9 Return value of the command

    Each command returns its exit status as the return value.

    This return value can be accessed by the $? shell variable immediately after the execution.

         $ [ 1 = 1 ] ; echo $?
         $ [ 1 = 2 ] ; echo $?

    Please note that, when the return value is used in the logical context for the shell, success is treated as the logical TRUE. This is somewhat non-intuitive since success bears value zero.

    See Shell conditionals, Kohta 13.2.5.

    4.3.10 Typical command sequences

    Let's try to remember following shell command idioms. See Shell parameters, Kohta 13.2.3, Shell redirection, Kohta 13.2.4, Shell conditionals, Kohta 13.2.5, and Command-line processing, Kohta 13.2.6 after reading these idioms. command &

    The command is executed in the subshell in the background. Background jobs allow users to run multiple programs in a single shell.

    The management of the background process involves the shell built-ins: jobs, fg, bg, and kill. Please read the sections of the bash(1) manual page under "SIGNALS", "JOB CONTROL", and "SHELL BUILTIN COMMANDS". [29] command1 | command2

    The standard output of command1 is fed to the standard input of command2 . Both commands may be running concurrently. This is called pipeline. command1 ; command2

    The command1 and command2 are executed sequentially. command1 && command2

    The command1 is executed. If successful, command2 is also executed sequentially. Return success if both command1 and command2 are successful. command1 || command2

    The command1 is executed. If not successful, command2 is also executed sequentially. Return success if command1 or command2 are successful. command > foo

    Redirect standard output of command to a file foo. (overwrite) command >> foo

    Redirect standard output of command to a file foo. (append) command > foo 2>&1

    Redirect both standard output and standard error of command to a file foo. command < foo

    Redirect standard input of command to a file foo. Try:

         $ </etc/motd pager
          ... (the greetings)
         $ pager </etc/motd
          ... (the greetings)
         $ pager /etc/motd
          ... (the greetings)
         $ cat /etc/motd | pager
          ... (the greetings)

    Although all 4 syntaxes display the same thing, the last example runs extra cat command and wastes resources with no reason.

    4.3.11 Command alias

    You can set an alias for the frequently used command. For example:

         $ alias la='ls -la'

    Now, la works as a short hand for ls -la which lists all files in the long listing format.

    You can identity exact path or identity of the command using type command. For example:

         $ type ls
         ls is hashed (/bin/ls)
         $ type la
         la is aliased to `ls -la'
         $ type echo
         echo is a shell builtin
         $ type file
         file is /usr/bin/file

    Here ls was recently searched while file was not, thus ls is "hashed", i.e., the shell has an internal record for the quick access to the location of the ls command.

    4.4 Unix-like text processing

    There are few standard text processing tools which are used very often on the Unix-like system.

    See Regular-expression substitution, Kohta 8.6.13, Script snippets for piping commands, Kohta 8.6.18, and Perl short script madness, Kohta 8.6.20 for some script examples.

    4.4.1 Regular expressions

    Regular expressions are used in many text processing tools. They are analogous to the shell wildcards (see Shell wildcards, Kohta 4.3.8), but they are both more complicated and more powerful.

    The regular expression describes the matching pattern and is made up of text characters and metacharacters. The metacharacter is just a character with a special meaning. There are 2 major styles, BRE and ERE, depending on the text tools as described in Unix-like text processing, Kohta 4.4.

    For the EREs, the metacharacters include "\ . [ ] ^ $ * + ? ( ) { } |". The regular expression means:

    In BREs the metacharacters "+ ? ( ) { } |" lose their special meaning; instead use the backslashed versions "\+ \? \( \) \{ \} \|". Thus the grouping construct (r1|r2) needs to be quoted as \(r1|r2\) in BREs. Since emacs, although being basically BRE, treats "+ ?" as the metacharacters. Thus there are no needs to quote them. See Replacement expressions, Kohta 4.4.2 for how the grouping construct is used.

    For example, grep can be used to perform the text search using the regular expression:

         $ egrep 'GNU.*LICENSE|Yoyodyne' /usr/share/common-licenses/GPL
                             GNU GENERAL PUBLIC LICENSE
                             GNU GENERAL PUBLIC LICENSE
           Yoyodyne, Inc., hereby disclaims all copyright interest in the program

    4.4.2 Replacement expressions

    For the replacement expression, following characters have special meanings:

    For Perl replacement string, $n is used instead of \n and & has no special meaning.

    For example:

         $ echo zzz1abc2efg3hij4 | \
           sed -e 's/\(1[a-z]*\)[0-9]*\(.*\)$/=&=/'
         $ echo zzz1abc2efg3hij4 | \
           sed -e 's/\(1[a-z]*\)[0-9]*\(.*\)$/\2===\1/'
         $ echo zzz1abc2efg3hij4 | \
           perl -pe 's/(1[a-z]*)[0-9]*(.*)$/$2===$1/'
         $ echo zzz1abc2efg3hij4 | \
           perl -pe 's/(1[a-z]*)[0-9]*(.*)$/=&=/'

    Here please pay extra attention to the style of the bracketed regular expression and how the matched strings are used in the text replacement process on different tools.

    These regular expressions can be used for the cursor movements and the text replacement actions in the editors too.

    Please read all the related manual pages to learn these commands.

    4.5 Unix-like filesystem

    In the GNU/Linux and other Unix-like OS systems, the files are organized into directories. [30] All files and directories are arranged in one big tree, the file hierarchy, rooted at /.

    These files and directories can be spread out over several devices. The mount(8) command serves to attach the file system found on some device to the big file tree. Conversely, the umount(8) command will detach it again.

    4.5.1 Unix file basics

    Here are the basics:

    The detailed best practices for the file hierarchy are described in the Filesystem Hierarchy Standard. You should remember the following facts as the starter:

    4.5.2 The filesystem concept in Debian

    Following the Unix tradition, the Debian system provides the filesystem under which physical data on harddisks and other storage devices, and the interaction with the hardware devices such as console screens and remote serial consoles are represented in an unified manner.

    Each file, directory, named pipe, or physical device on a Debian system has a data structure called an inode which describes its associated attributes such as the user who owns it (owner), the group that it belongs to, the time last accessed, etc. See /usr/include/linux/fs.h for the exact definition of struct inode in the Debian GNU/Linux system.

    This unified representation of physical entities is very powerful since this allows us to use the same command for the same kind of operation on many totally different devices.

    All your files could be on one disk --- or you could have 20 disks, some of them connected to a different computer elsewhere on the network. You can't tell just by looking at the directory tree, and nearly all commands work just the same way no matter what physical device(s) your files are really on.

    4.5.3 File and directory access permissions

    File and directory access permissions are defined separately for the following three categories of affected users:

    For a file, each corresponding permission allows:

    For a directory, each corresponding permission allows:

    Here, execute permission on the directory means not only to allow reading of files in its directory but also to allow viewing their attributes, such as the size and the modification time.

    To display permission information (and more) for files and directories, ls is used. See ls(1). When ls invoked with the -l option, it displays the following information in the order given:

    To change the owner of the file, chown is used from the root account. To change the group of the file, chgrp is used from the file's owner or root account. To change file and directory access permissions, chmod is used from the file's owner or root account. Basic syntax to manipulate foo file is:

         # chown newowner foo
         # chgrp newgroup foo 
         # chmod  [ugoa][+-=][rwx][,...] foo

    See chown(1), chgrp(1), and chmod(1) for the detail.

    For example, in order to make a directory tree to be owned by a user foo and shared by a group bar, issue the following commands from the root account:

         # cd /some/location/
         # chown -R foo:bar .
         # chmod -R ug+rwX,o=rX .

    There are three more special permission bits:

    Here the output of ls -l for these bits is capitalized if execution bits hidden by these outputs are unset.

    Setting set user ID on an executable file allows a user to execute the executable file with the owner ID of the file (for example root). Similarly, setting set group ID on an executable file allows a user to execute the executable file with the group ID of the file (for example root). Because these settings can cause security risks, enabling them requires extra caution.

    Setting set group ID on a directory enables the BSD-like file creation scheme where all files created in the directory belong to the group of the directory.

    Setting the sticky bit on a directory prevents a file in the directory from being removed by a user who is not the owner of the file. In order to secure the contents of a file in world-writable directories such as /tmp or in group-writable directories, one must not only set write permission off for the file but also set the sticky bit on the directory. Otherwise, the file can be removed and a new file can be created with the same name by any user who has write access to the directory.

    Here are a few interesting examples of the file permissions.

         $ ls -l /etc/passwd /etc/shadow /dev/ppp /usr/sbin/pppd
         crw-rw----    1 root     dip      108,   0 Jan 18 13:32 /dev/ppp
         -rw-r--r--    1 root     root         1051 Jan 26 08:29 /etc/passwd
         -rw-r-----    1 root     shadow        746 Jan 26 08:29 /etc/shadow
         -rwsr-xr--    1 root     dip        234504 Nov 24 03:58 /usr/sbin/pppd
         $ ls -ld /tmp /var/tmp /usr/local /var/mail /usr/src
         drwxrwxrwt    4 root     root         4096 Feb  9 16:35 /tmp
         drwxrwsr-x   10 root     staff        4096 Jan 18 13:31 /usr/local
         drwxrwsr-x    3 root     src          4096 Jan 19 08:36 /usr/src
         drwxrwsr-x    2 root     mail         4096 Feb  2 22:19 /var/mail
         drwxrwxrwt    3 root     root         4096 Jan 25 02:48 /var/tmp

    There is an alternative numeric mode to describe file permissions in chmod(1) commands. This numeric mode uses 3 to 4 digit wide octal (radix=8) numbers. Each digit corresponds to:

    This sounds complicated but it is actually quite simple. If you look at the first few (2-10) columns from ls -l command output and read it as a binary (radix=2) representation of file permissions ("-" being "0" and "rwx" being "1"), this numeric mode value should make sense as an octal (radix=8) representation of file permissions to you. [33] For example, try:

         $ touch foo bar
         $ chmod u=rw,go=r foo
         $ chmod 644 bar
         $ ls -l foo bar
         -rw-r--r--    1 penguin  penguin  0 Nov  3 23:30  foo
         -rw-r--r--    1 penguin  penguin  0 Nov  3 23:30  bar

    The default file permission mask can be set by using the umask shell built-in command. See builtins(7).

    4.5.4 Timestamps

    There are three types of timestamps for a GNU/Linux file:

    Note that ctime is not file creation time.

    Note that even simply reading a file on the Debian system will normally cause a file write operation to update atime information in the inode. Mounting a filesystem with the noatime option will let the system skip this operation and will result in faster file access for the read. See mount(8).

    Use touch(1) command to change timestamps of existing files.

    4.5.5 Links

    There are two methods of associating a file foo with a different filename bar.

    See the following example for the changes in link counts and the subtle differences in the result of the rm command.

         $ echo "Original Content" > foo
         $ ls -l foo
         -rw-r--r--    1 osamu    osamu           4 Feb  9 22:26 foo
         $ ln foo bar     # hard link
         $ ln -s foo baz  # symlink
         $ ls -l foo bar baz
         -rw-r--r--    2 osamu    osamu           4 Feb  9 22:26 bar
         lrwxrwxrwx    1 osamu    osamu           3 Feb  9 22:28 baz -> foo
         -rw-r--r--    2 osamu    osamu           4 Feb  9 22:26 foo
         $ rm foo
         $ echo "New Content" > foo
         $ cat bar
         Original Content
         $ cat baz
         New Content

    The symlink always has nominal file access permissions of "rwxrwxrwx", as shown in the above example, with the effective access permissions dictated by the permissions of the file that it points to.

    The . directory links to the directory that it appears in, thus the link count of any new directory starts at 2. The .. directory links to the parent directory, thus the link count of the directory increases with the addition of new subdirectories.

    4.5.6 Named pipes (FIFOs)

    A named pipe is a file that acts like a pipe. You put something into the file, and it comes out the other end. Thus it's called a FIFO, or First-In-First-Out: the first thing you put in the pipe is the first thing to come out the other end.

    If you write to a named pipe, the process which is writing to the pipe doesn't terminate until the information being written is read from the pipe. If you read from a named pipe, the reading process waits until there's something to read before terminating. The size of the pipe is always zero --- it doesn't store data, it just links two processes like the shell |. However, since this pipe has a name, the two processes don't have to be on the same command line or even be run by the same user.

    You can try it by doing the following:

         $ cd; mkfifo mypipe
         $ echo "hello" >mypipe & # put into background
         [1] 5952
         $ ls -l mypipe
         prw-r--r--    1 penguin penguin  0 2003-11-06 23:18 mypipe
         $ cat mypipe
         [1]+  Done                    echo hello >mypipe
         $ ls mypipe
         prw-r--r--    1 penguin penguin  0 2003-11-06 23:20 mypipe
         $ rm mypipe

    4.5.7 Sockets

    The socket is similar to the named pipe (FIFO) and allows processes to exchange information. For the socket, those processes do not need to be running at the same time nor need to be the children of the same ancestor process. This is the endpoint for the inter process communication. The exchange of information may occur over the network between different hosts.

    4.5.8 Device files

    Device files refer to physical or virtual devices on your system, such as your hard disk, video card, screen, or keyboard. An example of a virtual device is the console, represented by /dev/console.

    There are two types of devices:

    You can read and write device files, though the file may well contain binary data which may be an incomprehensible-to-humans gibberish. Writing data directly to these files is sometimes useful for the troubleshooting of hardware connections. For example, you can dump a text file to the printer device /dev/lp0 or send modem commands to the appropriate serial port /dev/ttyS0. But, unless this is done carefully, it may cause a major disaster. So be cautious. /dev/null etc.

    /dev/null is a special device file that discards anything you write to it. If you don't want something, throw it in /dev/null. It's essentially a bottomless pit. If you read /dev/null, you'll get an end-of-file (EOF) character immediately.

    /dev/zero is similar, only if you read from it you get the \0 character (not the same as the number zero ASCII). See Dummy files, Kohta 8.6.34. Device node number

    The device node number are displayed by executing ls as:

         $ ls -l /dev/hda /dev/ttyS0 /dev/zero
         brw-rw----    1 root     disk       3,   0 Mar 14  2002 /dev/hda
         crw-rw----    1 root     dialout    4,  64 Nov 15 09:51 /dev/ttyS0
         crw-rw-rw-    1 root     root       1,   5 Aug 31 03:03 /dev/zero


    In the older system, the installation process creates the device nodes using /sbin/MAKEDEV command. See MAKEDEV(8).

    In the newer system, the filesystem under in the /dev is automatically populated by the device filesystem similar to the /proc filesystem.

    4.5.9 /proc filesystem

    The /proc filesystem is a pseudo-filesystem and contains information about the system and running processes.

    People frequently panic when they notice one file in particular - /proc/kcore - which is generally huge. This is (more or less) a copy of the contents of your computer's memory. It's used to debug the kernel. It doesn't actually exist anywhere, so don't worry about its size.

    See Tuning the kernel through the proc filesystem, Kohta 7.3 and proc(5).

    4.6 X Window System

    See X, Kohta 9.4.

    4.6.1 Start the X Window System

    The X Window System can be started automatically with xdm-like graphical login daemon or type following from the console.

         $ exec startx

    4.6.2 Menu in the X Window System

    Since X environment can accommodate many window managers, their user interfaces vary quite a bit. Please remember that right-clicking the root window will bring up menu selections. This is always available.

    If you do not find menu entry, install the pertinent packages. See Debianin pakettien hallinnan aloitus, Kohta 6.2.

    4.6.3 Keyboard sequence for the X Window System

    Followings are the important keystrokes to remember when running the X Window System.

    4.7 Further study

    At this moment, I recommend you to read the key guide books from The Linux Documentation Project: Guides:

    See Support for Debian, Luku 15 for more learning resources.

    [ edellinen ] [ Sisällys ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ 15 ] [ A ] [ seuraava ]


    CVS, to 18.1.2007, 11:54:20 UTC

    Osamu Aoki osamu#at#debian.org
    Suomenkielinen käännös: Esko Arajärvi edu#at#iki.fi
    Tekijät, Kohta A.1