- •About the Author
- •Credits
- •How This Book Is Organized
- •Part I: Linux Basics
- •Part II: Installation
- •Part III: Configuration
- •Part IV: Administration
- •Part V: Maintaining the Linux System
- •How Each Chapter Is Structured
- •How to Use This Book
- •Conventions Used in This Book
- •What is Linux?
- •The origin of UNIX
- •Who started Linux?
- •Understanding Open Source
- •Understanding Closed Source
- •Understanding Artistic License
- •Is Freeware really free?
- •Is Shareware never free?
- •A comparison and contrast of licensing methods
- •The Growth of Linux
- •Linux on a Personal Computer
- •Graphical installation
- •Hardware detection
- •Graphical user interface
- •Linux limitations on the PC
- •Linux succeeds on the PC
- •Linux on workstations
- •Linux on servers
- •Summary
- •Assessment Questions
- •Scenarios
- •Answers to Chapter Questions
- •Assessment Questions
- •Scenarios
- •Linux Kernel
- •Kernel versions
- •Kernel availability
- •Linux Distributions
- •Beehive
- •BlueCat
- •Caldera OpenLinux
- •Debian
- •Corel
- •DragonLinux
- •Elfstone
- •Gentoo
- •Hard Hat Linux
- •KRUD
- •LinuxPPC
- •Mandrake
- •Phat Linux
- •Slackware
- •StormLinux
- •SuSE
- •TurboLinux
- •Yellow Dog Linux
- •Mini and Specialty Distributions
- •Astaro
- •KYZO
- •FlightLinux
- •NetMAX
- •Packages and Packaging Solutions
- •Red Hat Package Manager
- •Debian Package Management System
- •Tarball
- •Linux Resources
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Assessment Questions
- •Scenarios
- •Linux In the Real World
- •Word Processing
- •Spreadsheets and databases
- •Web browsing
- •File transfer
- •More, more, and more applications
- •The Server and DNS
- •A Linux Web server
- •Linux e-mail server
- •File servers
- •Proxy, news, and search servers
- •FTP servers
- •Firewalls
- •Determining Linux Roles and Services
- •Comparing Linux with other operating systems
- •Hardware compatibility
- •Summary
- •Assessment Questions
- •Scenarios
- •Answers to Chapter Questions
- •Assessment Questions
- •Scenarios
- •Installing Linux
- •Final Preparations for Installation
- •Verification
- •Package selection
- •Final hardware verification
- •Pre-installation partitioning planning
- •Installing Linux
- •Text or GUI installation
- •Basic setup of Linux
- •Selecting the machine type
- •Partitioning the hard disk drive
- •Installing a boot manager
- •Creating the Boot Diskette
- •Networking
- •Additional installation information
- •Accounts and passwords
- •Additional packages to install
- •GUI installation
- •Obtaining video card information
- •Configuring the X windows system
- •Selecting the windows manager or desktop environment
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Answers to Assessment Questions
- •Scenarios
- •Alternative to the GUI Installation
- •Command Line installation
- •Install the Linux system
- •Network installations of Linux
- •Review of a Linux Installation
- •Installation media
- •Initial selections
- •Installation type or class
- •Disk partitioning and formatting
- •Installing LILO
- •Network configuration
- •User accounts
- •Authentication methods
- •Package selection and installation
- •A Dual-Boot Installation of Linux
- •Linux with Microsoft Windows
- •Linux with Microsoft Windows NT and 2000
- •Linux and Solaris
- •Linux and other operating systems
- •Installing Additional Software with gzip and tar
- •Installing Additional Software with RPM
- •Removing software with RPM
- •Upgrading software with RPM
- •Query the RPM software
- •Verify the RPM software
- •Verify the package files
- •Upgrading the Kernel
- •Upgrading a Linux Kernel
- •System Log Files
- •The Final Test of the Installation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •What is the X Window System?
- •The X Window System
- •X Client and Server communications
- •X Window Manager
- •Configuring X Window Systems
- •Custom X Window System Programs
- •Manual Configuration of the X Window System
- •Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Basic Network Services
- •TCP/IP Protocol Suite
- •Connection protocols needed
- •Other network protocols
- •Configuring Basic Network Services
- •Host name
- •IP addressing
- •DHCP
- •Netmask
- •Hardware resources
- •Routing and gateways
- •PPP, SLIP and PLIP connections
- •Server Tasks with
- •IP aliases for virtual hosts
- •Apache Web Server
- •Samba File Server
- •Home directories
- •Disk shares
- •Configuring Client Services
- •SMB/CIFS
- •NIS client configuration
- •NFS client configuration
- •Configuring Internet Services
- •Web browser
- •POP and SMTP
- •TFTP
- •SNMP
- •Remote Access
- •Rlogin
- •Telnet
- •OpenSSH
- •Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Adding Hardware
- •Memory
- •Swap
- •Adding a hard drive
- •Video and monitor
- •Printers
- •Configuration files
- •Setting environment variables
- •BASH
- •Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Basic User and Group Administration
- •What are users and groups?
- •Creating users
- •Change user information
- •Deleting users
- •Creating groups
- •Getting Around Linux
- •Navigating Linux
- •Common file and directory commands
- •Setting File and Directory Permissions
- •Mounting and Managing File Systems
- •Mount
- •Umount
- •Mounted file systems
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Multi-User Environment
- •The creation of Virtual Consoles
- •The Linux Terminal Server Project
- •Configurations for remote systems
- •Monitoring remote connections
- •Common Shell Commands
- •Basic shell scripts
- •Caution using root access
- •Navigating the GUI interface
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Linux Runlevels
- •init
- •Shutting down Linux
- •Managing Linux Services
- •Configuring Linux Printing
- •lpd daemon
- •/etc/printcap
- •Printing management
- •Using the vi Editor
- •vi operation modes
- •Editing text files
- •Using the
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Disk and File System Management
- •Repairing Partitions
- •System Automation and Scheduling
- •cron
- •Core Dumps
- •Analyzing core dumps
- •GNU Debugger
- •Managing Networking Interfaces
- •Installing System Packages and Patches
- •Compressed archive
- •Debian Package Installer
- •Slackware Package Installation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Linux Processes
- •Core services versus non-critical services
- •Process administration
- •Process control
- •Monitoring Log Files
- •Maintaining Documentation
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Linux Security
- •Securing the Environment
- •Location
- •Environment
- •System Security
- •System/user files
- •Permissions
- •Log auditing
- •Backups
- •Linux Security Best Practices
- •Network security
- •Firewall
- •System security
- •Securing a Web server
- •Securing an FTP server
- •FTP program version
- •FTP configuration files
- •Process security
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Disaster Recovery Planning
- •Types of data
- •Frequency and Scheduling
- •Storage and media types
- •Recovering data
- •Offsite storage
- •Linux Backup Tools and Commands
- •Third party tools
- •Tape devices
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Identifying the Problem
- •Methodology and Best Practices
- •Troubleshooting Resources
- •Documentation resources
- •Internet resources
- •System Log Files
- •Tools for Log Files
- •Output to another file
- •Locating files
- •Process Configuration and Management
- •Stopping, Starting, and Restarting Processes
- •Configuration Files
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Examining the Startup Process
- •Boot process steps
- •Analyzing Boot Process Errors
- •Common Boot Problems
- •Using System Status Tools
- •File System Check
- •System Resource Commands
- •Using the System Boot Disk
- •Types of boot disks
- •Creating a boot disk
- •Creating a rescue/utility disk
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Common User Problems
- •Login problems
- •File and directory permissions
- •Printing problems
- •Mail problems
- •Software Package Problems
- •Package dependencies
- •Software and version conflicts
- •Backup and Restore Errors
- •Backup hardware
- •Backup software
- •File restore errors
- •Application Failures
- •Log files
- •Process and daemon errors
- •Web server errors
- •Telnet
- •Mail services
- •Basic Networking Troubleshooting
- •Networking connectivity
- •Network hardware problems
- •Summary
- •Assessment Questions
- •Scenarios
- •Lab Exercises
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •Mainboard Components
- •BIOS
- •System memory
- •System Resources
- •I/O addresses
- •Direct memory access
- •Laptop Considerations
- •PCMCIA
- •Linux Peripheral Configuration
- •Installing and Configuring SCSI Devices
- •SCSI definitions
- •SCSI technologies
- •SCSI cabling and termination
- •SCSI device configuration
- •Linux SCSI devices
- •ATA/IDE Devices
- •IDE drive configuration
- •Linux ATA/IDE Drive configuration
- •Linux Support for Other Devices
- •IEEE 1394 (Firewire)
- •Summary
- •Assessment Questions
- •Scenarios
- •Answers to Chapter Questions
- •Chapter Pre-test
- •Assessment Questions
- •Scenarios
- •What’s on the CD-ROM
- •System Requirements
- •Using the CD with Microsoft Windows
- •Using the CD with Linux
- •Microsoft Windows applications
- •Linux applications
- •Troubleshooting
- •Sample Exam
- •Exam Questions
- •Exam Answers
- •Taking a CompTIA Exam
- •How to register for an exam
- •What to expect at the testing center
- •Your exam results
- •If you don’t receive a passing score
- •About the Linux + Exam
- •Preparing for the Linux+ Exam
- •For More Information
- •Preamble
- •No Warranty
- •Glossary
- •Index
Chapter 11 Linux System Commands 369
If you are working on an existing file, you can use the cursor keys, or the h, j, k, l keys to navigate to where you want to begin. You can use the [ctrl-f] or [ctrl-b] to move ahead or back a page.
To insert text at an exact point, you can type the letter i for insert and start adding your text. Other options include the letter a, which adds text next to the cursor location, and the letter o, which starts your text on the next line below the current one.
If you make a mistake while typing, you can use the backspace key to delete characters. If you want to delete characters in command mode, hit the Escape key, and then use the letter x to delete characters one at a time. If you want to delete an entire line, use the dd command. The command dw deletes only the entire word that your cursor is currently on.
To save your file, hit the Escape key to enter command mode, and then type :w. To save and exit out of the vi editor, use the :wq command. Or you can use an equivalent to the :wq command — type the letters ZZ in command mode to save and then exit.
If you want to exit without saving your file, use the :q command. This command asks you if you want to save the file before quitting. If you want to bypass the prompt, use the :q! command.
Using the tar Command
4.12 Create, extract and edit file and tape archives using tar
The tar command is short for for tape archive. Originally, it was used for combining a large number of files into a single file for archival to tape. Even if you don’t plan to put files on tape, tar is a helpful archival tool that you can use to help manage your files.
The tar command does not compress files; it only combines them into one larger file. To compress files, you need to use the gzip or compress command.
The format of the tar command is:
tar [options] (file1) (file2) ...
You can use several options and arguments with the tar command:
-c: Tells tar to create a new archive file
-v: Prints each filename as it is archived
-f: Specifies a filename for the archive
-x: Tells tar to extract files from an archive
370 Part IV Administration
To back up the entire /home directory to a file called homebackup.tar, use the following command:
tar -cvf homebackup.tar /home
To extract the same file into the current directory, use the following command:
tar -xvf homebackup.tar
To back up three separate files, such as /etc/hosts, /etc/group, and /etc/passwd, to the archive etc.tar, use the following command:
cd /etc
tar -cvf etc.tar hosts group passwd
Know how to create and extract from a tar archive file.
Summary
This chapter details many system commands that are used routinely by the Linux system administrator. This chapter introduces the concepts of runlevels and how they interact with the init and shutdown commands, plus the location and purpose of startup scripts and how they can be used to stop and start services. This chapter discusses the management of print queues, including lpd daemon characteristics and print queue management commands. Finally, this chapter demonstrates the use of the tar command to create and extract archives, and explains some basic commands for the vi editor.
Here are some key points to remember from this chapter:
Runlevels
•0: Halt system
•1: Single User Mode
•2: Multiuser, no NFS
•3: Multiuser mode, no X
•4: Not used, user defined
•5: Multiuser mode with X
•6: Reboot
Chapter 11 Linux System Commands 371
Startup scripts for each runlevel — Located in /etc/rc.d/
Service administration commands — Most scripts located in /etc/rc.d/init.d. Options include start, restart, reload, stop
vi editor — Know the basic command to edit and save a text file
tar command — Used for making tape archive files, combines several files into\ one archive
tar -xvf [file] Used to extract files from archive tar -cvf [file] Used to create an archive
Printing
•lpd — Line Printer Daemon
•lpq — Used to check queue status
372 Chapter 11 Study Guide
STUDY GUIDE
The Study Guide section provides you with the opportunity to test your knowledge about the objectives covered on the exam. The Assessment Questions provide an understanding of the basics of Linux, and the Scenarios provide practice with real situations. If you get any questions incorrect, use the answers to determine the part of the chapter that you should review before continuing.
Assessment Questions
1.A Linux system seems to start up fine, but as soon as it is almost loaded it shuts down again. What is the most likely cause of the problem?
A.The Ctrl-Alt-Delete is stuck
B.The default runlevel is set to 5
C.The default runlevel is set to 0
D.The kill command is corrupted
2.What command should be used to shut down the system and halt in 100 seconds?
A.shutdown -r now
B.shutdown -h 100
C.halt
D.init 0 –100
3.Your /etc/rc.d/rc3.d contains a script called S10network. What is the purpose of this script?
A.To start the networking processes
B.To kill the networking processes
C.To reload the nfs daemon
D.To start the login process
4.What runlevel does init 5 represent?
A.Single User Mode
B.Halt system
C.Reboot
D.Full multiuser mode with X-windows
Chapter 11 Study Guide 373
5.What daemon controls the print spooling process?
A.lprm
B.lpd
C.lpq
D.lpstatus
6.What configuration file defines the default runlevel for the init process?
A./sbin/init
B./etc/rc.d/rc3.d
C./etc/inittab
D./etc/rc.d/init.d
7.What command should you use to save your file and quit the vi editor?
A.:wq
B.:w
C.:q!
D.save
8.What function can the tar comand not perform?
A.Create an archive file
B.Extract files from an archive
C.Combine several files into one file
D.Compress files
9.Which command can you use to shut down and halt a Linux System?
A.reboot
B.halt
C.init 1
D.shutdown -r 300
10.What init level should you set to bring the system to single-user mode?
A.init 1
B.init 0
C.init 3
D.init 5
374 Chapter 11 Study Guide
11.What command do you use to check the status of a print queue?
A.lp
B.lprm
C.lpq
D.lpstat
12.A user wants to restart the Web server because they want to enable changes made in the configuration file. What command accomplishes this task?
A./etc/rc.d/init.d/httpd start
B./etc/rc.d/init.d/httpd reload
C.httpd reboot
D.init 3
13.What file contains information about specific printer configurations?
A./etc/printcap
B./etc/printers
C./etc/lpd
D./etc/printconf
14.What command can you use to reboot a Linux system?
A.init 5
B.restart
C.shutdown -h
D.reboot
15.What mode must you be in when using vi editor to input text into a file?
A.super mode
B.command mode
C.text mode
D.insert mode
Chapter 11 Study Guide 375
16.Some users are complaining that the DHCP server is not running. After examing the running processes on the system, you notice that the process is not present. What command should you use to start the DHCP service?
A.dhcp restart
B.start dhcp
C./etc/rc.d/init.d/dhcpd start
D./etc/rc.d/init.d/dhcpd reload
17.What tar argument is used to extract files from an archive?
A.-x
B.-e
C.-f
D.-ext
18.What init runlevel should be set to shut down and reboot the system?
A.init 6
B.init 0
C.init 3
D.init 5
19.In what directory can you find the startup scripts for a system running in runlevel 5?
A./etc/rc.d
B./etc/rc.d/rc5.d
C./etc/init.d/rc5.d
D./etc/rc5.d
20.In the vi editor, what command should you use to quit without saving a file?
A.:wq!
B.:wq
C.:!
D.:q!