Product Details
Linux Pocket Guide (Pocket Guide: Essential Commands)

Linux Pocket Guide (Pocket Guide: Essential Commands)
By Daniel Barrett

List Price: £7.50
Price: £4.70 & eligible for FREE Super Saver Delivery on orders over £5. Details

Availability: Usually dispatched within 24 hours
Dispatched from and sold by Amazon.co.uk

46 new or used available from £2.45

Average customer review:

Product Description

O'Reilly's Pocket Guides have earned a reputation as inexpensive, comprehensive, and compact guides that have the stuff but not the fluff. Every page of Linux Pocket Guide lives up to this billing. It clearly explains how to get up to speed quickly on day-to-day Linux use. Once you're up and running, Linux Pocket Guide provides an easy-to-use reference that you can keep by your keyboard for those times when you want a fast, useful answer, not hours in the man pages. Linux Pocket Guide is organized the way you use Linux: by function, not just alphabetically. It's not the 'bible of Linux; it's a practical and concise guide to the options and commands you need most. It starts with general concepts like files and directories, the shell, and X windows, and then presents detailed overviews of the most essential commands, with clear examples. You'll learn each command's purpose, usage, options, location on disk, and even the RPM package that installed it. The Linux Pocket Guide is tailored to Fedora Linux--the latest spin-off of Red Hat Linux--but most of the information applies to any Linux system. Throw in a host of valuable power user tips and a friendly and accessible style, and you'll quickly find this practical, to-the-point book a small but mighty resource for Linux users.


Product Details

  • Amazon Sales Rank: #3721 in Books
  • Published on: 2004-02-18
  • Original language: English
  • Number of items: 1
  • Binding: Paperback
  • 224 pages

Editorial Reviews

Review
"Whilst there does seem to be a trend amongst many publishers to deliver ever more comprehensive titles, cramming details of almost every command-line switch and GUI option across a huge range of tools and packages, O'Reilly can always be relied upon to publish works that deal concisely with one aspecty of GNU/Linux or excel in offering a psecific functionality. Linux Pocket Guide is exemplary in this respect, cleverly avoiding the unnecessary bloat associated with titles that share the same subject matter - Fedora Linux. Indeed, this highly portable volume manages to kill two birds with one stone, funcitoning both as handy quick reference and an essential introduction to basic everyday tooks and commands. And though Fedora specifics such as desktop and package managerment are covered in some detail, nearly all of the material here could well be applied to almost any distro." Martin Howse, Linux User and Developer, Issue 40 "Can't memorise man pages? This is for you." Linux Format, Oct (top stuff award)

About the Author
Dan Barrett has been immersed in Internet technology since 1985. Currently working as a software engineer, Dan has also been a heavy metal singer, Unix system administrator, university lecturer, web designer, and humorist. He is the co-author of Linu

Excerpted from Linux Pocket Guide by Daniel J. Barrett. Copyright © 2004. Reprinted by permission. All rights reserved.
Programming with Shell Scripts

Earlier when we covered the shell (bash), we said it had a programming language built in. In fact, you can write programs, or shell scripts, to accomplish tasks that a single command cannot. Like any good programming language, the shell has variables, conditionals (if-then-else), loops, input and output, and more. Entire books have been written on shell scripting, so we’ll be covering the bare minimum to get
you started. For full documentation, run info bash.

Whitespace and Linebreaks
bash shell scripts are very sensitive to whitespace and linebreaks. Because the "keywords" of this programming language are actually commands evaluated by the shell, you need to separate arguments with whitespace. Likewise, a linebreak in the middle of a command will mislead the shell into thinking the command is incomplete. Follow the conventions we present here and you should be fine.

Variables
We described variables earlier:

$ MYVAR=6
$ echo $MYVAR
6

All values held in variables are strings, but if they are numeric the shell will treat them as numbers when appropriate.

$ NUMBER="10"
$ expr $NUMBER + 5
15

When you refer to a variable’s value in a shell script, it’s a good idea to surround it with double quotes to prevent certain runtime errors. An undefined variable, or a variable with spaces in its value, will evaluate to something unexpected if not surrounded by quotes, causing your script to malfunction.

$ FILENAME="My Document" Space in the name
$ ls $FILENAME Try to list it
ls: My: No such file or directory Oops! Ls saw 2 arguments
ls: Document: No such file or directory
$ ls -l "$FILENAME" List it properly
My Document ls saw only 1 argument

If a variable name is evaluated adjacent to another string, surround it with curly braces to prevent unexpected behavior:

$ HAT="fedora"
$ echo "The plural of $HAT is $HATs"
The plural of fedora is Oops! No variable "HATs"
$ echo "The plural of $HAT is s"
The plural of fedora is fedoras What we wanted
Input and Output
Script output is provided by the echo and printf commands, which we described in "Screen Output" on page 144:

$ echo "Hello world"
Hello world
$ printf "I am %d years old\n" `expr 20 + 20`
I am 40 years old

Input is provided by the read command, which reads one line from standard input and stores it in a variable:

$ read name
Sandy Smith
$ echo "I read the name $name"
I read the name Sandy Smith

Booleans and Return Codes
Before we can describe conditionals and loops, we need the concept of a Boolean (true/false) test. To the shell, the value 0 means true or success, and anything else means false or failure.

Additionally, every Linux command returns an integer value, called a return code or exit status, to the shell when the command exits. You can see this value in the special variable $?:

$ cat myfile
My name is Sandy Smith and
I really like Fedora Linux
$ grep Smith myfile
My name is Sandy Smith and A match was found...
$ echo $?
0 ...so return code is "success"
$ grep aardvark myfile
$ echo $? No match was found...
1 ...so return code is "failure"

The return codes of a command are usually documented on its manpage.


Customer Reviews

Superb companion to "Linux in a Nutshell"5
The book is the perfect pocket guide to Linux. Never mind the Fedora slant. This book will introduce you to all the important commands and if you want to take anything further O'Reilly's "Linux in a Nutshell" is the perfect companion.

Excellent5
I don't envy Mr Barrett's task with this book. Everybody has a slightly different wishlist of commands to go in a book like this; it's impossible to please everybody. That said, I think he's got it about as close to perfection as possible. This book has an incredible amount of useful info in a usefully small volume. If like me you can normally remember the command, but always struggle to remember the right option (which one do you add to TAR for BZ2 files?) this book is a godsend.

Great command reference5
This is an excellent reference to Linux commands - perfect when you need to get something done, but do not know the command to use, or cannot remember the syntax of a particular command. Top drawer! I have had the O'Reilly "Running Linux" book for a number of years, but this book is a great companion/replacement.