A Hands On Guide

Transcription

Introduction to LinuxA Hands on GuideMachtelt Garrels, Garrels.be tille wants no spam at garrels dot be

Introduction to Linux: A Hands on Guideby Machtelt GarrelsPublication date 20080606Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Machtelt Garrels

Table of ContentsIntroduction . xiWhy this guide? . xiWho should read this book? . xiNew versions and availability . xiRevision History . xiiContributions . xiiiFeedback . xiiiCopyright information . xiiiWhat do you need? . xivConventions used in this document . xivOrganization of this document . xv1. What is Linux? . 1History . 1UNIX . 1Linus and Linux . 2Current application of Linux systems . 3The user interface . 3Is Linux difficult? . 3Linux for non-experienced users . 4Does Linux have a future? . 4Open Source . 4Ten years of experience at your service . 5Properties of Linux . 6Linux Pros . 6Linux Cons . 7Linux Flavors . 8Linux and GNU . 8GNU/Linux . 9Which distribution should I install? . 9Summary . 10Exercises . 112. Quickstart . 12Logging in, activating the user interface and logging out . 12Introduction . 12Graphical mode . 12Text mode . 14Absolute basics . 14The commands . 14General remarks . 15Using Bash features . 16Getting help . 17Be warned . 17The man pages . 17More info . 19Summary . 23Exercises . 24Connecting and disconnecting . 24Passwords . 24Directories . 25Files . 25Getting help . 26iii

Introduction to Linux3. About files and the file system .General overview of the Linux file system .Files .About partitioning .More file system layout .Orientation in the file system .The path .Absolute and relative paths .The most important files and directories .The most important configuration files .The most common devices .The most common variable files .Manipulating files .Viewing file properties .Creating and deleting files and directories .Finding files .More ways to view file content .Linking files .File security .Access rights: Linux's first line of defense .The tools .Summary .Exercises .Partitions .Paths .Tour of the system .Manipulating files .File permissions .4. Processes .Processes inside out .Multi-user and multi-tasking .Process types .Process attributes .Displaying process information .Life and death of a process .SUID and SGID .Boot process, Init and shutdown .Introduction .The boot process .GRUB features .Init .Init run levels .Shutdown .Managing processes .Work for the system admin .How long does it take? .Performance .Load .Can I do anything as a user? .Scheduling processes .Use that idle time! .The sleep command .The at command .Cron and crontab 38888888889

Introduction to LinuxSummary . 91Exercises . 92General . 92Booting, init etc. . 93Scheduling . 935. I/O redirection . 94Simple redirections . 94What are standard input and standard output? . 94The redirection operators . 94Advanced redirection features . 97Use of file descriptors . 97Examples . 98Filters . 99More about grep . 99Filtering output . 99Summary . 100Exercises . 1016. Text editors . 103Text editors . 103Why should I use an editor? . 103Which editor should I use? . 103Using the Vim editor . 104Two modes . 104Basic commands . 105The easy way . 106Linux in the office . 106History . 106Suites and programs . 107Remarks . 107Summary . 107Exercises . 1087. Home sweet /home . 109General good housekeeping . 109Introduction . 109Make space . 109Your text environment . 112Environment variables . 112Shell setup files . 115A typical set of setup files . 115The Bash prompt . 118Shell scripts . 120The graphical environment . 122Introduction . 122The X Window System . 123X server configuration . 124Region specific settings . 125Keyboard setup . 125Fonts . 125Date and time zone . 126Language . 126Country-specific Information . 127Installing new software . 127General . 127Package formats . 127v

Introduction to LinuxAutomating package management and updates . 130Upgrading your kernel . 131Installing extra packages from the installation CDs . 132Summary . 133Exercises . 134Shell environment . 134Graphical environment . 1358. Printers and printing . 136Printing files . 136Command line printing . 136Formatting . 137The server side . 138General . 138Graphical printer configuration . 139Buying a printer for Linux . 139Print problems . 139Wrong file . 139My print hasn't come out . 139Summary . 141Exercises . 1419. Fundamental Backup Techniques . 143Introduction . 143Preparing your data . 143Moving your data to a backup device . 147Making a copy on a floppy disk . 147Making a copy with a CD-writer . 149Backups on/from jazz drives, USB devices and other removables . 150Backing up data using a tape device . 150Tools from your distribution . 151Using rsync . 151Introduction . 151An example: rsync to a USB storage device . 151Encryption . 152General remarks . 152Generate a key . 152About your key . 153Encrypt data . 154Decrypting files . 154Summary . 154Exercises . 15510. Networking . 156Networking Overview . 156The OSI Model . 156Some popular networking protocols . 157Network configuration and information . 159Configuration of network interfaces . 159Network configuration files . 159Network configuration commands . 160Network interface names . 162Checking the host configuration with netstat . 163Other hosts . 163Internet/Intranet applications . 165Server types . 166Mail . 167vi

Introduction to LinuxWeb .File Transfer Protocol .Chatting and conferencing .News services .The Domain Name System .DHCP .Authentication services .Remote execution of applications .Introduction .Rsh, rlogin and telnet .The X Window System .The SSH suite .VNC .The rdesktop protocol .Cygwin .Security .Introduction .Services .Update regularly .Firewalls and access policies .Intrusion detection .More tips .Have I been hacked? .Recovering from intrusion .Summary .Exercises .General networking .Remote connections .Security .11. Sound and Video .Audio Basics .Installation .Drivers and Architecture .Sound and video playing .CD playing and copying .Playing music files .Recording .Video playing, streams and television watching .Internet Telephony .What is it? .What do you need? .Summary .

Many people still believe that learning Linux is difficult, or that only experts can understand how a Linux system works. Though there is a lot of free documentation available, the documentation is widely scattered on the Web, and often confusing, since it is usually oriented