Sams Teach Yourself UNIX in 10 Minutes, Second Edition will help you quickly and easily learn UNIX essentials and review UNIX features and functions.. You will learn to: Get onto the sys
Trang 1SAMS Teach Yourself Unix in 10 Minutes
By Robert Shimonski
Publisher: Sams Publishing
Pub Date: June 15, 2005
ISBN: 0-672-32764-3
Pages: 256
Table of Contents | Index
If you're in need of a quick, concise tutorial to learn Unix and get on your way, this is it Sams Teach
Yourself UNIX in 10 Minutes, Second Edition will help you quickly and easily learn UNIX essentials and review UNIX features and functions You will master components of UNIX programming through clear, concise learning modules and step-by-step instructions without having to wade through a lot of fluff and theory You will learn to:
Get onto the system and use the command line
•
Move about the file system
•
Create, move, rename and delete files and directories
•
Slice and dice command pipe data
•
Use the vi Editor
•
Print in the UNIX environment
•
And more!
•
Whatever your expertise level, Sams Teach Yourself UNIX in 10 Minutes will get you up and running with UNIX in no time
SAMS Teach Yourself Unix in 10 Minutes
By Robert Shimonski
Publisher: Sams Publishing
Pub Date: June 15, 2005
ISBN: 0-672-32764-3
Pages: 256
Table of Contents | Index
Copyright
About
the
Author
Acknowledgments
We
Want
to
Hear
from
You!
Trang 2Services Introduction Welcome to
Sams Teach Yourself Unix in
10
Minutes Unix Overview Versions of
Unix Teach Yourself Unix in
10
Minutes How
Do
You
Use
Unix? Getting More Information Who
This
Book Is
For
Author Note
Conventions Used in
This
Book Lesson 1 Getting Started
Practicing with
Unix: It
Really Does Make
Trang 3Perfect!
Prepare
to
Log
In
The
Login
Process
The
Logout
Process
Shell
Game
Working
Within
the
Shell
Summary
Lesson 2
Getting
Help
Finding
Help
in
Unix
Using
the
Unix
Man
Pages
More
Help
Even
More
Help!
Graphical
Help
(Using
KDE)
Additional
Documentation
Summary
Lesson 3
Interfacing
with
Unix
Graphically
Overview
of
the
X
Trang 4Window System How
Many
Windows Are
There? X
Window System Functionality Window Placement X
Window System Look
and
Feel
Window Managers Desktop Environments Summary Lesson 4 The
File
System
Explained File
System Design Navigating the
File
System Navigating the
File
System with
the
GUI
Summary Lesson 5 File
System
Navigation Techniques Using
the
find
Trang 5Finding
Data
with
Other
Unix
Commands
The
grep
Command
Using
the
KDE
Find
Feature
Summary
Lesson 6
Working
with
the
Shell
Working
with
Files
at
the
Unix
Shell
Prompt
Summary
Lesson 7
Reading
Files
The
cat
Command
Making
Output
Readable
with
Pagers
The
tail
Command
Summary
Lesson 8
Text
Editing
Text
Editing
with
Trang 6The
vi
Editor The
emacs Editor Desktop Environment Tools: KDE's Built-in Editor Summary Lesson 9 Text
and
File
Utilities The
wc
Command The
split
Command The
diff
and
patch Commands Tying It
All
Together: File
Management Skills Test
Summary Lesson 10 Compression and
Archiving Tools
Managing Files
in
Unix
Managing Your
Disk
Usage
Trang 7Files
in
Unix
The
tar
Command
Using
uuencode/uudecode
Summary
Lesson 11
Managing
Processes
in
Unix
Multitasking
The
ps
Command
The
kill
Command
The
at
and
cron
Commands
Summary
Lesson 12
Input
and
Output
I/O
Redirection
Standard
I/O
Pipes
Summary
Lesson 13
Regular
Expressions
Pattern
Matching
and
Regular
Expressions
Using
and
*
Using
Trang 8and
^
Using
^
(Again) and
$
Summary Lesson 14 Shell
Scripting Fundamentals Building Unix
Shell
Script Files
Using foreach Using while and
if
Summary Lesson 15 User
Utilities Using chsh
The
passwd Command Using finger and
chfn
Using date
Using uptime Using who
Summary Lesson 16 Modifying Your
Environment Aliases Environment Variables
Trang 9Using
Dot
Files
Working
with
the
GUI
Summary
Lesson 17
Printing
with
Unix
The
lpr
Command
The
lpq
Command
The
lprm
Command
Summary
Lesson 18
Networking
and
Security
Using
telnet
Using
ssh
Using
rlogin
Using
slogin
Using
ftp
Summary
Lesson 19
Configuring
Permissions
in
Unix
Unix
File
and
Directory
Permissions
Using
ls
-l
Trang 10chmod
Using
chgrp
Summary
Lesson 20
Unix
Privileged
Commands
Root
Refresher
Single-User
Mode
fsck
shutdown/reboot
Summary
Appendix A
Learn
More
About
Unix:
Reference
Index
Copyright
Copyright © 2005 by Sams Publishing
All rights reserved No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher No patent liability is assumed with respect to the use of the information contained herein Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions Nor is any liability assumed for damages resulting from the use of the information contained herein
Library of Congress Catalog Card Number: 2004098030
Printed in the United States of America
First Printing: June 2005
08 07 06 05 4 3 2 1
Trademarks
All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized Sams Publishing cannot attest to the accuracy of this information Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark
Trang 11Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied The information provided is on an "as is" basis The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book
Bulk Sales
Sams Publishing offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales For more information, please contact
U.S Corporate and Government Sales
1-800-382-3419
corpsales@pearsontechgroup.com
For sales outside of the U.S., please contact
International Sales
international@pearsoned.com
Credits
Acquisitions Editor
Jenny Watson
Development Editor
Scott Meyers
Managing Editor
Charlotte Clapp
Project Editor
Mandie Frank
Copy Editor
Laura Town
Indexer
Tim Wright
Technical Editor
Christopher Heinz
Publishing Coordinator
Vanessa Evans
Trang 12Interior Designer
Gary Adair
Cover Designer
Aren Howell
Page Layout
Brad Chinn
About the Author
Robert Shimonski is a well-known networking and security expert consulting out of the Long Island, New York area Rob has authored over 30 books on information technology that include topics specializing in systems engineering with Unix and Microsoft technologies, as well as networking and security design with Check Point and Cisco technologies
Rob has also deployed state-of-the-art technology in hundreds of companies worldwidejust recently designing and implementing a global MPLS network spanning hundreds of sites Rob was fortunate to have been able to keep up with his love for Unix by deploying Linux systems and freeware networking and security tools such
as Ethereal, NMIS, and MRTG, to name a few
Because of Rob's unique blend of Unix- and Linux-related real world experience, Rob has served as a
technical editor and author on countless Unix- and Linux- related articles and books Rob was also the
networking and security expert chosen to help develop and design LinuxWorld Magazine You can view LinuxWorld Magazine at http://www.linuxworld.com To learn more about Roberts's book projects, please visit him at www.rsnetworks.net
Acknowledgments
I would like to thank everyone who helped me create this booka personal thank you to all who went the extra mile when we needed it most The editors, thank you very much for giving me the tools I needed to make this book a reality
Jenny Watson, thank you for presenting me with this project and working with me to develop it My technical editor, Christopher Heinz, and developmental editor, Scott Meyers, for working with me through "crunch time" and being my extra eyes on the printed page
We Want to Hear from You!
As the reader of this book, you are our most important critic and commentator We value your opinion and want to know what we're doing right, what we could do better, what areas you'd like to see us publish in, and any other words of wisdom you're willing to pass our way
You can email or write me directly to let me know what you did or didn't like about this bookas well as what
we can do to make our books stronger
Trang 13Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able to reply to every message
When you write, please be sure to include this book's title and author as well as your name and phone or email address I will carefully review your comments and share them with the author and editors who worked on the book
Email: opensource@samspublishing.com
Mail: Mark Taber
Associate Publisher
Sams Publishing
800 East 96th Street
Indianapolis, IN 46240 USA
Reader Services
For more information about this book or another Sams Publishing title, visit our website at
www.samspublishing.com Type the ISBN (excluding hyphens) or the title of a book in the Search field to find the page you're looking for
Introduction
Welcome to Sams Teach Yourself Unix in 10 Minutes
Unix Overview
Versions of Unix
Teach Yourself Unix in 10 Minutes
How Do You Use Unix?
Getting More Information
Who This Book Is For
Author Note
Conventions Used in This Book
Welcome to Sams Teach Yourself Unix in 10 Minutes
Welcome to Sams Teach Yourself Unix in 10 Minutes If you are new to Unix or just want to learn more about it, you have undoubtedly chosen the perfect companion for your journey Whatever your reasons were for picking up this book, you will be glad that you did, because it is filled with useful information to help you learn Unix This book's mission is to ensure that you walk away with a fundamental understanding of Unix, how to navigate and use it, and how to become more productive with it Another goal of this book is to show
Trang 14you other avenues for gathering information that will help you continue your education beyond the lessons herein
Unix Overview
Because of growing market share from companies such as Red Hat, Sun, IBM, and Novell, it's no wonder that Unix is becoming more and more of a household name Unix (and Linux, which is Linus Torvald's version of Unix) is now found in most firewall and Web-server-based systems as well as all the way to the desktop for end user productivity and development Unix has deep roots in the computer industry First surfacing in universities and the military, it began to grow more and more in use with the massive development and expansion of the Internet Once Linux was released, the landscape of Unix changed forever Now, Linux (an easier to use version of the Unix operating system) and Unix are both found almost everywhere you look, and
to ignore them is simply impossible
Some common versions of Unix (called distributions, or distros for short) you may have heard of are Sun Solaris, IBM AIX, FreeBSD, Red Hat Linux, SuSE Linux (also known as Novell SUSE), and SCO ACE Although these versions of the Unix operating system have differences, they all share the same thing: a basic Unix kernel that can be openly worked on and developed by anyone with the knowledge to do so In this book, we will focus on the similarities between all versions of Unix so that you can use any one of them and still be productive
Unix is a very powerful multitasking operating system Multitasking refers to performing multiple tasks at once; in this context, it more specifically means that a user can run multiple programs simultaneously within one single logon of the system Unix is also a multiuser operating system What this means is that many users can simultaneously (and securely) use the same machine In addition, Unix is open source software, which means that users are free to look at and modify its code This is not the case with proprietary versions of Unix, but most versions are open source, so unless you are working with a specific vendor that does not allow its version of Unix to be altered, it's safe to assume that most versions (especially Linux versions) can be
modified Another powerful tool to unleash with Unix is the power of coding and scripting Entire user communities work with and help develop Unix programs, and this is what keeps the system growing,
developing, and getting better each and every year This is not commonly seen with other proprietary
operating system platform vendors such as Microsoft Most of these vendors release closed source systems, which means you cannot freely write code that works blindly with these systems
There is much more to learn about Unix You are encouraged to find out more about its history and origins on the Web; this way, we can focus more written pages on teaching you how to use Unix (At the end of this book, however, there is a reference section that will help you locate additional information on Unix, its history, and where it is going in the future.) So, now that you know that Unix is rapidly growing in use, let's take a second to understand why this book is so important, how this book should be used, how this book is organized, and how you will learn Unix productively
Versions of Unix
Before we get too involved in this book, there is one thing that needs to be made clear: There are many versions of Unix, also called flavors or distros (short for distributions) In this book, all versions will be referenced as "Unix" unless there is something specific that needs to be said about a certain version or
distribution Since Unix, Linux, and all its cousins are so similar, they are said to be in the same family, but as you know, people in your family don't all look or act the same, do they? Nonetheless, you can think of Unix
as a family of sorts, one with a great heritage, many grandparents, and plenty of recorded history to laugh about
Trang 15This book (just like the first edition) has been written to be as general as possible and to not favor any one vendor or implementation This way, you can learn in the least confusing way possible; after all, the more complications you are exposed to while learning, the more your learning progress is hindered Again, in this book, Unix is Unix unless otherwise noted
If something in an example doesn't work on your system, don't be alarmedcheck the
online manuals or ask other users of your machine Different versions of Unix
sometimes have slightly different versions of commandsit will be worth your time to
learn how things work on your system as well as how things work on other distributions
of Unix
Teach Yourself Unix in 10 Minutes
In each 10-minute lesson, you are given a small amount of material to master In most cases, the material in each lesson builds on that presented in the previous lesson, so although you can jump around between lessons, you will be best served to start the book at the beginning and move through it in order You can come back and forth as you master each lesson, in case you forget a command or how to do something
This book is divided into seven parts Part I, "Learning the Unix Environment: Baby Steps," covers logging in
to a Unix (or Linux) system so you can begin to learn Unix You will learn how to get into Unix (and Linux)
so that you can work within it Part I also shows you the essentials of how to help yourself, which is important when using any new system
Learning how to find and use documentation is one of the keys to survival when it comes to learning Unix Part II, "Navigating the Unix File System," covers the file system, how to navigate it, and so on Part III, "File System Utilities," explains how to manipulate and work with files as well as how to use some of the tools that come with the system to edit, archive, and compress files Part IV, "Working with the Shell," covers working with the shell and how to use scripts Although you won't become a master of shell scripting overnight, you will start to see how powerful Unix can be if you know how to work with it Part V, "Environment
Customization," covers user utilities as well as how to modify your environment Part VI, "Networking and Communications," is new to the second edition of this book; you will learn how to print with Unix as well as how to set up basic networking and security Part VII, "Tips and Tricks," covers advanced topics and some Linux so that you can work within Linux (since it's easier to get and use) and learn Unix in the convenience of your home or anywhere else you may want to put a new Linux- or Unix-based system
How Do You Use Unix?
Unless you're simply using a Unix machine as a platform for a prepackaged commercial application, most of your interaction with Unix is likely to be textual commands typed at a command-line prompt Most
implementations of Unix do provide a graphical user interface (GUI); however, even when running the GUI, much of what you are likely to do involves typing commands into terminal windows that are available in the GUI We will be covering both in this book, because some versions of Unix install graphically as well as allow you to initially log in to the system graphically This being said, it is imperative to learn the
fundamentals of both methods if you are to progress past the login portion of this book presented in Part I
So, are you worried about minimal graphical help? You shouldn't be; that's why you are reading this book! As previously mentioned, you will learn both graphical and textual methods in this book Dragging and dropping and using a mouse are still options in some Unix systems, but the strength of Unix is at the command line You will see this as you read through each chapter You will be introduced to K Desktop Environment (KDE),