Linux_Pocket_Guide.pdf

(2206 KB) Pobierz
Linux Pocket Guide
3RD EDITION
Daniel J. Barrett
Linux Pocket Guide
by Daniel J. Barrett
Copyright © 2016 Daniel Barrett. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online
editions are also available for most titles (http://safaribooksonline.com). For more information,
contact our corporate/institutional sales department: 800-998-9938 or
corporate@oreilly.com.
Editor: Nan Barber
Production Editor: Nicholas Adams
Copyeditor: Jasmine Kwityn
Proofreader: Susan Moritz
Indexer: Daniel Barrett
Interior Designer: David Futato
Cover Designer: Karen Montgomery
Illustrator: Rebecca Demarest
June 2016: Third Edition
Revision History for the Third Edition
2016-05-27: First Release
See
http://oreilly.com/catalog/errata.csp?isbn=9781491927571
for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.
Linux Pocket Guide,
the cover
image, and related trade dress are trademarks of O’Reilly Media, Inc.
While the publisher and the author have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the author disclaim all
responsibility for errors or omissions, including without limitation responsibility for damages
resulting from the use of or reliance on this work. Use of the information and instructions contained in
this work is at your own risk. If any code samples or other technology this work contains or describes
is subject to open source licenses or the intellectual property rights of others, it is your responsibility
to ensure that your use thereof complies with such licenses and/or rights.
978-1-491-92757-1
[M]
Chapter 1. Linux Pocket Guide
Welcome to Linux! If you’re a new user, this book can serve as a quick introduction, as well as a
guide to common and practical commands. If you have Linux experience, feel free to skip the
introductory material.
What’s in This Book?
This book is a short guide,
not a comprehensive reference.
We cover important, useful aspects of
Linux so you can work productively. We do not, however, present every single command and every
last option (our apologies if your favorite was omitted), nor delve into detail about operating system
internals. Short, sweet, and essential—that’s our motto.
We focus on commands, those pesky little words you type on a command line to tell a Linux system
what to do. Here’s an example command that counts lines of text in a file,
myfile:
wc -l myfile
We’ll cover the most important Linux commands for the average user, such as ls (list files), grep
(search for text), mplayer (play audio and video files), and df (measure free disk space). We touch
only briefly on graphical windowing environments like GNOME and KDE, each of which could fill a
Pocket Guide
by itself.
We’ve organized the material by function to provide a concise learning path. For example, to help
you view the contents of a file, we introduce many file-viewing commands together: cat for short text
files, less for longer ones, od for binary files, and so on. Then we explain each command in turn,
briefly presenting its common uses and options.
We assume you have access to a Linux system and know how to log in with your username and
password. If not, get your hands on a Linux “live” DVD, such as
Ubuntu, Fedora,
or
Knoppix,
which
you can boot on most computers to play around with Linux.
What’s New in the Third Edition?
New commands
Technology changes quickly, and some commands that made sense to cover in the first two
editions are barely used today. We’ve replaced these commands with new ones that you’ll find
immediately practical on a modern Linux system.
Runnable examples
You can now download a set of files from
the book’s website
and run the book’s example
commands as you read them.
Goodbye, GUI applications
We no longer cover applications that have graphical user interfaces, such as photo editors and
web browsers, in order to focus purely on commands. You can find these applications yourself
pretty easily these days just by searching the Web.
What’s Linux?
Linux is a popular, open source operating system that competes with Microsoft Windows and Mac
OS X. Like these other operating systems, Linux has a graphical user interface with windows, icons,
and mouse control. However, the real power of Linux comes from its command-line interface, called
the shell, for typing and running commands like the preceding wc.
Windows and Mac OS X computers can be operated by command line as well (Windows with its
cmd and PowerShell command tools, and OS X with its Terminal application), but most of their users
can get along fine without typing commands. On Linux, the shell is critical. If you use Linux without
the shell, you are missing out.
What’s a Distro?
Linux is extremely configurable and includes thousands of programs. As a result, different varieties of
Linux have arisen to serve different needs and tastes. They all share certain core components but may
look different and include different programs and files. Each variety is called a distro (short for
“distribution”). Popular distros include Ubuntu Linux, Red Hat Enterprise Linux, Slackware, and
Mint among others. This book covers core material that should apply to every distro.
What’s a Command?
A Linux command typically consists of a program name followed by options and arguments, typed
within a shell, like this:
wc -l myfile
The program name (wc, short for “word count”) refers to a program somewhere on disk that the shell
will locate and run. Options, which usually begin with a dash, affect the behavior of the program. In
the preceding command, the -l option tells wc to count lines and not words. The argument myfile
specifies the file that wc should read and process.
Commands can have multiple options and arguments. Options may be given individually:
wc -l -w myfile
Two individual options
Zgłoś jeśli naruszono regulamin