Download as pdf or txt
Download as pdf or txt
You are on page 1of 39

Linux Bible Christopher Negus

Visit to download the full and correct content document:


https://ebookmass.com/product/linux-bible-christopher-negus/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

Linux Bible 10th Edition Christopher Negus

https://ebookmass.com/product/linux-bible-10th-edition-
christopher-negus/

Ubuntu Linux Bible 10th Edition David Clinton

https://ebookmass.com/product/ubuntu-linux-bible-10th-edition-
david-clinton/

Ubuntu Linux Bible 10th Edition Edition David Clinton

https://ebookmass.com/product/ubuntu-linux-bible-10th-edition-
edition-david-clinton/

Linux+ and LPIC-1 Guide to Linux Certification, 5th


Edition Jason W. Eckert

https://ebookmass.com/product/linux-and-lpic-1-guide-to-linux-
certification-5th-edition-jason-w-eckert/
Linux+ and LPIC-1 Guide to Linux Certification, 5th
Edition Jason W. Eckert

https://ebookmass.com/product/linux-and-lpic-1-guide-to-linux-
certification-5th-edition-jason-w-eckert-2/

The Pancreatitis Diet Bible

https://ebookmass.com/product/the-pancreatitis-diet-bible/

Linux Containers and Virtualization: Utilizing Rust for


Linux Containers 2nd Edition Shashank Mohan Jain

https://ebookmass.com/product/linux-containers-and-
virtualization-utilizing-rust-for-linux-containers-2nd-edition-
shashank-mohan-jain/

The Enterprise Linux Administrator: Journey to a New


Linux Career 1st Edition Kenneth Hitchcock

https://ebookmass.com/product/the-enterprise-linux-administrator-
journey-to-a-new-linux-career-1st-edition-kenneth-hitchcock/

The Consulting Bible Alan Weiss

https://ebookmass.com/product/the-consulting-bible-alan-weiss/
The ultimate guide to mastering Linux COMPANION WEBSITE
COMPANION WEBSITE
Find more information and links to Linux
Visit www.indesigncentral.com for addi- GRUMAN
NEGUS COMPANION WEBSITE
WRITTEN BY
distributions on the companion website: CHRISTOPHER NEGUS
tional tools, updates, resources, tips, and
This fully updated 10th edition of Linux Bible gives beginners and intermediate users www.wiley.com/go/linuxbible10e
alike the knowledge and skills to take Linux to the next level. With an emphasis on more.
command-line tools and a focus on the latest versions of Red Hat Enterprise Linux,
Fedora, and Ubuntu, renowned Linux expert and bestselling author Christopher
Negus guides you step-by-step through detailed demonstrations and exercises

Linux
designed to provide you with a thorough understanding and working knowledge of
the Linux operating system. Linux Bible, 10th Edition also provides exam prep
materials for various Linux certifications.
Linux is at the heart of most technological advances in cloud computing and that
means you need a solid understanding of Linux to work effectively in tomorrow’s
data centers. The Linux basics you learn early on in the book are applied in later

Linux
chapters as the author demonstrates how to deploy Linux systems as hypervisors,
Start with any Linux
cloud controllers, and virtual machines, as well as manage virtual networks and
networked storage. system and advance ®
Linux Bible, 10th Edition shows you how to get and install Linux, begin using it, and
ultimately excel at administering and securing it. This book is also an excellent
to enterprise Linux
resource for software developers who wish to use Linux as a developer workstation. computing
The Linux Bible, 10th Edition shows you how to: • Use your favorite Linux
• Get started with Linux distribution to learn and
• Implement data center automation with Ansible
test your skills with Linux
command-line tools
• Access a shell and write simple shell scripts
• Simplify system administration with Cockpit • Learn professional system
• Secure Linux systems and networks
administration tasks using
Fedora 30, Red Hat Enterprise
• Configure various servers and troubleshoot common problems
Linux 8, Ubuntu 18.04, or
• Create Linux virtual machines that run on hypervisors and cloud platforms
other enterprise-ready Linux
• Learn containerization with Docker and Podman, including container orchestration systems
with Kubernetes and OpenShift
• Deploy Linux to the cloud

®
Christopher Negus has been teaching and writing about Linux
and UNIX for more than 25 years. He is an instructor and principal
technical writer for Red Hat, Inc., and the author of dozens of Linux
and UNIX books, including Red Hat Linux Bible (all editions), CentOS EXPLORE THE LATEST MASTER INSIDE TRICKS DISCOVER WHAT YOU
Bible, Fedora Bible, Ubuntu Linux Toolbox, Linux Troubleshooting Bible,
TOOLS AND FEATURES AND BEST PRACTICES NEED, WHEN YOU NEED IT
Linux Toys, and Linux Toys II.
www.wiley.com/go/linuxbible10
Cover Image: © iStockphoto.com/aleksandar velasevic

$60.00 USA TENTH EDITION


$72.00 CAN

SHELVING CATEGORY:
Computers/Operating Systems/Linux
READER LEVEL:
Beginning to Advanced
TENTH EDITION
The ultimate guide to mastering Linux COMPANION WEBSITE
COMPANION WEBSITE
Find more information and links to Linux
Visit www.indesigncentral.com for addi- GRUMAN
NEGUS COMPANION WEBSITE
WRITTEN BY
distributions on the companion website: CHRISTOPHER NEGUS
tional tools, updates, resources, tips, and
This fully updated 10th edition of Linux Bible gives beginners and intermediate users www.wiley.com/go/linuxbible10e
alike the knowledge and skills to take Linux to the next level. With an emphasis on more.
command-line tools and a focus on the latest versions of Red Hat Enterprise Linux,
Fedora, and Ubuntu, renowned Linux expert and bestselling author Christopher
Negus guides you step-by-step through detailed demonstrations and exercises

Linux
designed to provide you with a thorough understanding and working knowledge of
the Linux operating system. Linux Bible, 10th Edition also provides exam prep
materials for various Linux certifications.
Linux is at the heart of most technological advances in cloud computing and that
means you need a solid understanding of Linux to work effectively in tomorrow’s
data centers. The Linux basics you learn early on in the book are applied in later

Linux
chapters as the author demonstrates how to deploy Linux systems as hypervisors,
Start with any Linux
cloud controllers, and virtual machines, as well as manage virtual networks and
networked storage. system and advance ®
Linux Bible, 10th Edition shows you how to get and install Linux, begin using it, and
ultimately excel at administering and securing it. This book is also an excellent
to enterprise Linux
resource for software developers who wish to use Linux as a developer workstation. computing
The Linux Bible, 10th Edition shows you how to: • Use your favorite Linux
• Get started with Linux distribution to learn and
• Implement data center automation with Ansible
test your skills with Linux
command-line tools
• Access a shell and write simple shell scripts
• Simplify system administration with Cockpit • Learn professional system
• Secure Linux systems and networks
administration tasks using
Fedora 30, Red Hat Enterprise
• Configure various servers and troubleshoot common problems
Linux 8, Ubuntu 18.04, or
• Create Linux virtual machines that run on hypervisors and cloud platforms
other enterprise-ready Linux
• Learn containerization with Docker and Podman, including container orchestration systems
with Kubernetes and OpenShift
• Deploy Linux to the cloud

®
Christopher Negus has been teaching and writing about Linux
and UNIX for more than 25 years. He is an instructor and principal
technical writer for Red Hat, Inc., and the author of dozens of Linux
and UNIX books, including Red Hat Linux Bible (all editions), CentOS EXPLORE THE LATEST MASTER INSIDE TRICKS DISCOVER WHAT YOU
Bible, Fedora Bible, Ubuntu Linux Toolbox, Linux Troubleshooting Bible,
TOOLS AND FEATURES AND BEST PRACTICES NEED, WHEN YOU NEED IT
Linux Toys, and Linux Toys II.
www.wiley.com/go/linuxbible10
Cover Image: © iStockphoto.com/aleksandar velasevic

$60.00 USA TENTH EDITION


$72.00 CAN

SHELVING CATEGORY:
Computers/Operating Systems/Linux
READER LEVEL:
Beginning to Advanced
TENTH EDITION
Linux®
Bible
Tenth Edition
Lin ®

BIBLE
Tenth Edition

Christopher Negus
Copyright © 2020 by John Wiley & Sons, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-1-119-57888-8
ISBN: 978-1-119-57891-8 (ebk)
ISBN: 978-1-119-57889-5 (ebk)
Manufactured in the United States of America
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by
any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under
Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of
the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance
Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher
for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street,
Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties
with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties,
including without limitation warranties of fitness for a particular purpose. No warranty may be created or
extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for
every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal,
accounting, or other professional services. If professional assistance is required, the services of a competent
professional person should be sought. Neither the publisher nor the author shall be liable for damages arising
herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential
source of further information does not mean that the author or the publisher endorses the information the
organization or website may provide or recommendations it may make. Further, readers should be aware that
Internet websites listed in this work may have changed or disappeared between when this work was written and
when it is read.
For general information on our other products and services please contact our Customer Care Department within
the United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with
standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to
media such as a CD or DVD that is not included in the version you purchased, you may download this material at
http://booksupport.wiley.com . For more information about Wiley products, visit www.wiley.com .
Library of Congress Control Number: 2019956690
Trademarks: Wiley and the Wiley logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or
its affiliates, in the United States and other countries, and may not be used without written permission. Linux is
a registered trademark of Linus Torvalds. All other trademarks are the property of their respective owners. John
Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
As always, I dedicate this book to my wife, Sheree.
About the Author
Chris Negus is a principal technical writer for Red Hat, Inc. In more than a decade with Red
Hat, Chris has taught hundreds of IT professionals to become Red Hat Certified Engineers
(RHCEs), and he has written scores of documents on everything from Linux to virtualization
to cloud computing and containerization.
Before joining Red Hat, Chris wrote or co-wrote dozens of books on Linux and UNIX, includ-
ing the Red Hat Linux Bible (all editions), Docker Containers, CentOS Bible, Fedora Bible, Linux
Troubleshooting Bible, Linux Toys, Linux Toys III, and, nine editions of this Linux Bible. Chris
also co-authored several books for the Linux Toolbox series for power users: Fedora Linux
Toolboxx, SUSE Linux Toolboxx, Ubuntu Linux Toolboxx, Mac OS X Toolboxx, and BSD UNIX Toolboxx.
Before becoming an independent author, Chris worked for eight years with the organization
at AT&T that developed the UNIX operating system before moving to Utah to help contribute
to Novell’s UnixWare project in the early 1990s. When not writing about Linux, Chris enjoys
playing soccer, hanging out with his wife, Sheree, and spending what time he can with his
sons, Seth and Caleb.

vii
About the Technical Editors
Jason W. Eckert is an experienced technical trainer, consultant, and best-selling author in
the Information Technology (IT) industry. With 45 industry certifications, over 30 years of
IT experience, 4 published apps, and 24 published textbooks covering topics such as UNIX,
Linux, security, Windows Server, Microsoft Exchange Server, PowerShell, BlackBerry Enter-
prise Server, and video game development, Mr. Eckert brings his expertise to every class that
he teaches at triOS College in his role as the Dean of Technology. For more information about
Mr. Eckert, visit jasoneckert.net.
Derrick Ornelas is a senior software maintenance engineer at Red Hat, Inc. In his current
role as a product lead for Red Hat container technologies, including OpenShift Container Plat-
form and Red Hat Enterprise Linux CoreOS, Derrick works to ensure both the supportability
and quality of Red Hat ’s products. Previously, he worked as a senior technical support lead
for Red Hat virtualization technologies, such as libvirt, KVM, and the Red Hat Virtualiza-
tion product.
During his 12 years at Red Hat, Derrick earned the Red Hat Certified Engineer and Red Hat
Certified Virtualization Administrator certifications, and he has applied his broad Linux
knowledge to architect, deploy, and maintain various hardware labs and applications.
Derrick ’s nearly two decades of Linux experience began while earning his BS in Computer
Science from Appalachian State University. As a devoted Linux supporter, he enjoys teaching
and assisting new Linux users both on and off the clock. When he’s not working on his
monitor tan, Derrick enjoys mountain biking, motorcycling, and backpacking with his
wife, Carolyn.

ix
gm
W
hen I was hired at Red HHat ab bout a dozen years ago, I didn’t know that Red Hat
would grow to about seven
sev times its size, be bought by IBM for $34 billion, and (so
far) still maintain the spirit of openness and excitement that it had when I fi rst
signed on. Every day when I come to work, I interact with many of the greatest Linux and
cloud developers, testers, instructors, and support professionals in the world.
While I can’t thank everyone individually,
ually, I would like to salute the culture of cooperation
and excellence at Red Hat that serves to improve my own Linux skills every day. I don’t speak
well of Red Hat because I work there; I work at Red Hat because it lives up to the ideals of
open source software in ways that match my own beliefs.
That said, there are a few Red Hatters that I want to acknowledge in particular. At Red Hat,
I’m able to take on so many cool and challenging projects because of the freedom that I
receive from the people to whom I report. They include Michelle Bearer, Dawn Eisner, and Sam
Knuth. Sam, in particular, has had my back and encouraged my work for more than a decade.
In my daily work, I want to give a shout out to Red Hatters Scott McCarty, Ben Breard,
Laurie Friedman, Dave Darrah, Micah Abbott, Steve Milner, and Ian McLeod (container tools,
RHCOS, and OpenShift teams), and Tom McKay, Joey Schorr, Bill Dettelback, Richa Marwaha,
and Dirk Herrmann (Quay team). Finally, a special thank you to Vikram Goyal, who luckily
lives in Australia, so he is always available to bail me out when I blow up git in the middle of
the night.
When it comes to support for writing this book, I have had the luxury of two excellent tech-
nical editors: Jason Eckert and Derrick Ornelas. I didn’t know Jason before he took on this
role, but his broad experience with different Linux systems has helped call me out when I get
too Red Hat centric. Derrick, who I see almost every day, was asked to do this work because
of his attention to detail and deep understanding of how Linux works and what people need
to know to use it. Anyone reading this book will have a better experience because of the
work that Jason and Derrick have done reviewing it.
As for the people at Wiley, thanks for letting me continue to develop and improve this book
over the years. Thanks to Gary Schwartz, who applies constant, gentle pressure to keep me
working on this book at times when I had no spare cycles to work on it. When Gary ’s pressure
wasn’t enough, Devon Lewis would step in to paint a clearer picture about the importance of
deadlines. Thanks also to Margot Maley Hutchison from Waterside Productions for contracting
the book for me with Wiley and always looking out for my best interests.
Finally, thanks to my wife, Sheree, for sharing her life with me and doing such a great job
raising Seth and Caleb.
—Christopher Negus

xi
at
Acknowledgments ........................................................................................................ xi
Introduction ............................
............................................................................................................ xxxv

Part I: Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1


Chapter 1: Starting with Linux ....................................................................................... 3
Chapter 2: Creating the Perfect Linux x Desktop ................................................................27

Part II: Becoming a Linux Power Userr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59


Chapter 3: Using the Shell .............................................................................................61
Chapter 4: Moving Around the Filesystem .................................................................... 93
Chapter 5: Working with Text Files .............................................................................. 113
Chapter 6: Managing Running Processes ....................................................................... 131
Chapter 7: Writing Simple Shell Scripts ........................................................................ 147

Part III: Becoming a Linux System Administratorr . . . . . . . . . . . . . . . . . . . 165


Chapter 8: Learning System Administration ................................................................. 167
Chapter 9: Installing Linux ......................................................................................... 195
Chapter 10: Getting and Managing Software ................................................................. 221
Chapter 11: Managing User Accounts............................................................................ 249
Chapter 12: Managing Disks and Filesystems ................................................................ 273

Part IV: Becoming a Linux Server Administrator . . . . . . . . . . . . . . . . . . . 305


Chapter 13: Understanding Server Administration ........................................................ 307
Chapter 14: Administering Networking ........................................................................ 339
Chapter 15: Starting and Stopping Services .................................................................. 369
Chapter 16: Configuring a Print Server .........................................................................403
Chapter 17: Configuring a Web Server ........................................................................... 427
Chapter 18: Configuring an FTP Server ......................................................................... 455
Chapter 19: Configuring a Windows File Sharing (Samba) Server..................................... 475
Chapter 20: Configuring an NFS File Server ................................................................... 499
Chapter 21: Troubleshooting Linux .............................................................................. 523

Part V: Learning Linux Security Techniques . . . . . . . . . . . . . . . . . . . . . . . 563


Chapter 22: Understanding Basic Linux Security ........................................................... 565
Chapter 23: Understanding Advanced Linux Security .................................................... 599
Chapter 24: Enhancing Linux Security with SELinux ..................................................... 635
Chapter 25: Securing Linux on a Network ..................................................................... 663

xiii
Contents at a Glance

Part VI: Engaging with Cloud Computingg . . . . . . . . . . . . . . . . . . . . . . . . . 691


Chapter 26: Shifting to Clouds and Containers .............................................................. 693
Chapter 27: Using Linux for Cloud Computing ............................................................... 709
Chapter 28: Deploying Linux to the Cloud .................................................................... 729
Chapter 29: Automating Apps and Infrastructure with Ansible ...................................... 749
Chapter 30: Deploying Applications as Containers with Kubernetes ................................ 765

Part VII: Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785


Appendix A: Media ..................................................................................................... 787
Appendix B: Exercise Answers ..................................................................................... 797

Index ........................................................................................................................ 863

xiv
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxv

Part I: Getting Started 1


Chapter 1: Starting with Linuxx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Understanding What Linux Is ................................................................................ 4
Understanding How Linux Differs from Other Operating Systems .............................. 6
Exploring Linux History ........................................................................................ 7
Free-flowing UNIX culture at Bell Labs ........................................................... 7
Commercial UNIX ......................................................................................... 9
Berkeley Software Distribution arrives .................................................. 9
UNIX Laboratory and commercialization ...............................................10
GNU transitions UNIX to freedom .................................................................11
BSD loses some steam ..................................................................................12
Linus builds the missing piece .....................................................................13
OSI open source defi nition ...........................................................................14
Understanding How Linux Distributions Emerged ...................................................16
Choosing a Red Hat distribution ...................................................................16
Using Red Hat Enterprise Linux ...........................................................17
Using Fedora ......................................................................................18
Choosing Ubuntu or another Debian distribution ...........................................19
Finding Professional Opportunities with Linux Today .............................................19
Understanding how companies make money with Linux .................................20
Becoming Red Hat certified ..........................................................................21
RHCSA topics ......................................................................................22
RHCE topics ........................................................................................23
Summary ............................................................................................................25
Chapter 2: Creating the Perfect Linux Desktop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Understanding Linux Desktop Technology .............................................................28
Starting with the Fedora GNOME Desktop Live image ..............................................30
Using the GNOME 3 Desktop ..................................................................................31
After the computer boots up ........................................................................31
Navigating with the mouse ..................................................................32
Navigating with the keyboard..............................................................36
Setting up the GNOME 3 desktop ..................................................................38

xv
Contents

Extending the GNOME 3 desktop ...................................................................39


Using GNOME shell extensions..............................................................39
Using the GNOME Tweak Tool ...............................................................40
Starting with desktop applications ...............................................................41
Managing files and folders with Nautilus ..............................................42
Installing and managing additional software ........................................43
Playing music with Rhythmbox ...........................................................45
Stopping the GNOME 3 desktop .....................................................................46
Using the GNOME 2 Desktop ..................................................................................46
Using the Metacity window manager ........................................................... 48
Changing GNOME’s appearance ......................................................................49
Using the GNOME panels ..............................................................................50
Using the Applications and System menus ............................................51
Adding an applet ................................................................................51
Adding another panel .........................................................................52
Adding an application launcher ...........................................................52
Adding a drawer .................................................................................53
Changing panel properties ...................................................................54
Adding 3D effects with AIGLX ......................................................................54
Summary ............................................................................................................57
Exercises .............................................................................................................57

Part II: Becoming a Linux Power User 59


Chapter 3: Using the Shell. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
About Shells and Terminal Windows ......................................................................62
Using the shell prompt ................................................................................63
Using a Terminal window .............................................................................63
Using virtual consoles .................................................................................65
Choosing Your Shell .............................................................................................65
Running Commands .............................................................................................66
Understanding command syntax ..................................................................67
Locating commands .....................................................................................70
Recalling Commands Using Command History ........................................................72
Command-line editing .................................................................................73
Command-line completion............................................................................75
Command-line recall ....................................................................................76
Connecting and Expanding Commands ..................................................................78
Piping between commands ...........................................................................78
Sequential commands ..................................................................................79
Background commands ................................................................................79
Expanding commands ..................................................................................80
Expanding arithmetic expressions ................................................................80
Expanding variables ....................................................................................80

xvi
Contents

Using Shell Variables ............................................................................................81


Creating and using aliases ...........................................................................81
Exiting the shell .........................................................................................83
Creating Your Shell Environment .......................................................................... 84
Configuring your shell ................................................................................ 84
Setting your prompt ....................................................................................85
Adding environment variables .....................................................................87
Getting Information about Commands ...................................................................88
Summary ............................................................................................................90
Exercises .............................................................................................................90
Chapter 4: Moving Around the Filesystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Using Basic Filesystem Commands .........................................................................96
Using Metacharacters and Operators ......................................................................98
Using file-matching metacharacters ..............................................................98
Using file-redirection metacharacters ...........................................................99
Using brace expansion characters ............................................................... 101
Listing Files and Directories ............................................................................... 101
Understanding File Permissions and Ownership .................................................... 105
Changing permissions with chmod (numbers) .............................................. 106
Changing permissions with chmod (letters)................................................. 107
Setting default file permission with umask ................................................. 108
Changing file ownership ............................................................................ 109
Moving, Copying, and Removing Files .................................................................. 109
Summary .......................................................................................................... 111
Exercises ........................................................................................................... 111
Chapter 5: Working with Text Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
Editing Files with vim and vi .............................................................................. 113
Starting with vi ........................................................................................ 115
Adding text...................................................................................... 115
Moving around in the text ................................................................ 116
Deleting, copying, and changing text................................................. 117
Pasting (putting) text ....................................................................... 118
Repeating commands ........................................................................ 118
Exiting vi ......................................................................................... 118
Skipping around in the file ........................................................................ 119
Searching for text ..................................................................................... 119
Using ex mode .......................................................................................... 120
Learning more about vi and vim ................................................................. 120
Finding Files ..................................................................................................... 120
Using locate to fi nd files by name ............................................................... 121
Searching for files with fi nd ....................................................................... 122
Finding files by name........................................................................ 123
Finding files by size .......................................................................... 124

xvii
Contents

Finding files by user ......................................................................... 124


Finding files by permission................................................................ 125
Finding files by date and time ........................................................... 125
Using ‘not’ and ‘or’ when fi nding files ................................................. 126
Finding files and executing commands ............................................... 127
Searching in files with grep ....................................................................... 128
Summary .......................................................................................................... 129
Exercises ........................................................................................................... 129
Chapter 6: Managing Running Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Understanding Processes .................................................................................... 131
Listing Processes ............................................................................................... 132
Listing processes with ps ........................................................................... 132
Listing and changing processes with top.....................................................134
Listing processes with System Monitor........................................................ 136
Managing Background and Foreground Processes.................................................. 137
Starting background processes ...................................................................138
Using foreground and background commands .............................................. 139
Killing and Renicing Processes............................................................................ 140
Killing processes with kill and killall .......................................................... 140
Using kill to signal processes by PID.................................................. 140
Using killall to signal processes by name ............................................ 141
Setting processor priority with nice and renice ........................................... 142
Limiting Processes with cgroups ......................................................................... 143
Summary ..........................................................................................................144
Exercises ........................................................................................................... 145
Chapter 7: Writing Simple Shell Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Understanding Shell Scripts................................................................................ 147
Executing and debugging shell scripts ........................................................ 148
Understanding shell variables .................................................................... 149
Special shell positional parameters .................................................... 150
Reading in parameters ...................................................................... 151
Parameter expansion in bash ............................................................. 151
Performing arithmetic in shell scripts......................................................... 152
Using programming constructs in shell scripts ............................................ 153
The ″if. . .then″ statements ............................................................... 153
The case command ............................................................................ 156
The ″for. . .do″ loop .......................................................................... 157
The ″while. . .do″ and ″until. . .do″ loops ........................................... 158
Trying some useful text manipulation programs .......................................... 159
The general regular expression parser................................................. 159
Remove sections of lines of text (cut) ................................................ 159
Translate or delete characters (tr) ...................................................... 160
The stream editor (sed) ..................................................................... 160

xviii
Another random document with
no related content on Scribd:
Abb. 46

Grünewald
Isenheimer Altar
Teilstück: Magdalena
Abb. 47

Grünewald
Isenheimer Altar
Himmelfahrt Christi
Abb. 48

Grünewald
Isenheimer Altar
Himmelfahrt
Teilstück
DRUCK VON ERNST HEDRICH
NACHF., G. M. B. H., LEIPZIG
*** END OF THE PROJECT GUTENBERG EBOOK
NATURALISMUS, IDEALISMUS, EXPRESSIONISMUS ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying copyright
royalties. Special rules, set forth in the General Terms of Use part of
this license, apply to copying and distributing Project Gutenberg™
electronic works to protect the PROJECT GUTENBERG™ concept
and trademark. Project Gutenberg is a registered trademark, and
may not be used if you charge for an eBook, except by following the
terms of the trademark license, including paying royalties for use of
the Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is very
easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund from
the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law in
the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name
associated with the work. You can easily comply with the terms of
this agreement by keeping this work in the same format with its
attached full Project Gutenberg™ License when you share it without
charge with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the terms
of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears, or
with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning of
this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1 with
active links or immediate access to the full terms of the Project
Gutenberg™ License.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or expense
to the user, provide a copy, a means of exporting a copy, or a means
of obtaining a copy upon request, of the work in its original “Plain
Vanilla ASCII” or other form. Any alternate format must include the
full Project Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt that
s/he does not agree to the terms of the full Project Gutenberg™
License. You must require such a user to return or destroy all
copies of the works possessed in a physical medium and
discontinue all use of and all access to other copies of Project
Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except


for the “Right of Replacement or Refund” described in paragraph
1.F.3, the Project Gutenberg Literary Archive Foundation, the owner
of the Project Gutenberg™ trademark, and any other party
distributing a Project Gutenberg™ electronic work under this
agreement, disclaim all liability to you for damages, costs and
expenses, including legal fees. YOU AGREE THAT YOU HAVE NO
REMEDIES FOR NEGLIGENCE, STRICT LIABILITY, BREACH OF
WARRANTY OR BREACH OF CONTRACT EXCEPT THOSE
PROVIDED IN PARAGRAPH 1.F.3. YOU AGREE THAT THE
FOUNDATION, THE TRADEMARK OWNER, AND ANY
DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE LIABLE
TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL,
PUNITIVE OR INCIDENTAL DAMAGES EVEN IF YOU GIVE
NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving it,
you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or entity
that provided you with the defective work may elect to provide a
replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth in
paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.
1.F.6. INDEMNITY - You agree to indemnify and hold the
Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and distribution
of Project Gutenberg™ electronic works, harmless from all liability,
costs and expenses, including legal fees, that arise directly or
indirectly from any of the following which you do or cause to occur:
(a) distribution of this or any Project Gutenberg™ work, (b)
alteration, modification, or additions or deletions to any Project
Gutenberg™ work, and (c) any Defect you cause.

Section 2. Information about the Mission of


Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many small
donations ($1 to $5,000) are particularly important to maintaining tax
exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About Project


Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.

Project Gutenberg™ eBooks are often created from several printed


editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.

You might also like