Transcript Document

Linux
Fundamentals
© 2001 ComputerPREP, Inc. All rights reserved.
Lesson 1:
UNIX and
Linux Basics
© 2001 ComputerPREP, Inc. All rights reserved.
Objectives
• Explain some of the distinctive features of UNIX
and Linux
• Relate Linux architecture to System V and BSD
architectures
• Log on to a Linux machine and change your
password
• Understand the basic structure of Linux
commands
• Access the online help system
A Brief History
• System V and BSD
• System V and BSD characteristics
• Linux
– Open Source Movement
Characteristics
of Linux
•
•
•
•
Linux is multiuser
Linux is multitasking
Linux is weakly integrated
UNIX/Linux is command-line oriented
Your Logon
Account
• Logging on and off
– The root account
• Changing your password
The Logon
Environment
• Logon shell
• Home directory
• Environment variables
Linux
Commands
• Command arguments and options
– Specific man commands
– Preparing the man database with makewhatis
Summary
 Explain some of the distinctive features of UNIX
and Linux
 Relate Linux architecture to System V and BSD
architectures
 Log on to a Linux machine and change your
password
 Understand the basic structure of Linux
commands
 Access the online help system
Lesson 2:
Files and
Directories
© 2001 ComputerPREP, Inc. All rights reserved.
Objectives
• Describe how Linux handles files, directories, and
subdirectories
• Navigate the Linux directory tree
• Create and delete subdirectories
• Read and modify file permissions
Linux File
Name Conventions
• Up to 256 characters allowed
• No prohibition of the use of spaces
• No formal rules related to file name extensions
Hidden Files
• Will not show in directory listings by default
The File
System
• Single tree of directories and subdirectories
• Root directory represented by slash ( / )
Paths
• Absolute paths
• Relative paths and the current working directory
• Periods, double periods, and tildes
Working
with Directories
•
•
•
•
•
Listing directories
Long form listing
Changing the working directory
Creating subdirectories
Deleting subdirectories
File and
Directory Permissions
• Control of access at three levels
– User
– Group
– Everyone (or other)
• Changing permissions
Summary
 Describe how Linux handles files, directories, and
subdirectories
 Navigate the Linux directory tree
 Create and delete subdirectories
 Read and modify file permissions
Lesson 3:
Text Editing with
Vi, Emacs, and Pico
© 2001 ComputerPREP, Inc. All rights reserved.
Objectives
• Use the vi text editor to create and edit files
• Use the emacs text editor to create and edit
files
• Describe basic Pico commands
Vi
• Running vi
• Edit mode and command
mode
• Vi command structure
• Quitting vi
• Cursor movement
• Inserting text into a file
• Deleting, pasting, and
yanking
• Search and replace
commands
• Working with multiple files
• Customizing vi and the
.exrc file
Emacs
•
•
•
•
•
•
•
•
Running emacs
Emacs commands
Quitting emacs
Interrupting an emacs
command
Emacs windows
Emacs buffers
Emacs cursor commands
Deleting, cutting, and
pasting
• The mark, the point, and
the region
• Undo
• Searching
• Emacs commands (long
form)
• Emacs help
• File name and command
completion
• Customizing emacs
Pico
• Commands
Summary
 Use the vi text editor to create and edit files
 Use the emacs text editor to create and edit files
 Describe basic Pico commands
Lesson 4:
An Arsenal of
Linux Commands
© 2001 ComputerPREP, Inc. All rights reserved.
Objectives
• Copy and rename files
• List files in a variety of ways using the more, less,
cat, head, and tail commands
• Perform a wide range of operations using Linux
commands
• Use network client programs for remote logon file
transfer and Web browsing
• Use a graphical shell and configure system
parameters with linuxconf and netconf
Copying, Moving,
and Deleting Files
• cp: copies files
• mv: moves and renames files and directories
• rm: deletes files
File Content-Listing
Commands
•
•
•
•
more: views text files page by page
cat: prints the contents of files onto terminal
tac: prints file contents in reverse order
head and tail: views the first few or last few
lines of a file
• nl: numbers the lines of a file
• tee: writes all output into a file
Simple Text
File Utilities
• wc: displays a count of lines, words, and
characters
• diff: reports differences between files
• od: displays a binary file in human-readable form
• strings: finds printable characters in a binary file
• tee: allows instant file creating
• ispell: types misspelled words from a file
Miscellaneous
Commands
•
•
•
•
date: shows and sets time and date
w: lists logon information about users
cal: provides a monthly calendar
bc: runs a calculator utility
Network
Clients
• Telnet
• FTP
• Lynx
Archiving
and Compression
•
•
•
•
Using tar to create and extract archives
Using compress and uncompress
Using gzip and gunzip
using zip and unzip
Midnight
Commander
• Limited graphical shell program that ships with
Linux
– Editing files
The
Linuxconf Utility
• Limited graphical shell
• Allows you to set system parameters
The
Netconf Utility
• Calls up the Network Configurator
Summary
 Copy and rename files
 List files in a variety of ways using the more, less,
cat, head, and tail commands
 Perform a wide range of operations using Linux
commands
 Use network client programs for remote logon file
transfer and Web browsing
 Use a graphical shell and configure system
parameters with linuxconf and netconf
Lesson 5:
I/O Redirection
and Filters
© 2001 ComputerPREP, Inc. All rights reserved.
Objectives
• Apply the I/O redirection operators in a wide range
of situations
• "Glue" UNIX utilities together to use them
effectively
• Use the sort filter and related commands to
operate on files
• Use the sed, grep, and awk commands to search
files and select desired fields
• Deploy additional text filtering commands
Standard Input, Standard
Output, and Standard Error
• Standard input = issuing a command that the OS
reads and processes
• Standard output = first stream
• Standard error = second stream
I/O Redirection
•
•
•
•
•
I/O redirection operators
Filters
Pipelines
Redirecting standard error
Discarding standard error with /dev/null
The Sort, Grep,
Awk and Sed Utilities
• Sort
– Sorts files
• Grep
– Searches for patterns
• Awk
– Processes its own programming language
• Sed
– Allows file contents to be edited without
opening
Additional
Commands
•
•
•
•
•
•
Join
Split
Cut
Paste
Fmt
Tr
Summary
 Apply the I/O redirection operators in a wide range
of situations
 "Glue" UNIX utilities together to use them
effectively
 Use the sort filter and related commands to
operate on files
 Use the sed, grep, and awk commands to search
files and select desired fields
 Deploy additional text filtering commands
Lesson 6:
Working
with the Shell
© 2001 ComputerPREP, Inc. All rights reserved.
Objectives
• Use shell wildcards, command history, file name
completion, and job control
• View and set environmental variables
• Work with subshells and local shell variables
• Write simple shell scripts
The
UNIX Shell
•
•
•
•
sh—Bourne shell
ksh—Korn shell
csh—C shell
bash—Bourne-again shell
The
Interactive Shell
•
•
•
•
•
Shell wildcards
Quoting and escapes
The tilde and home directories
Command-line editing and command history
File name completion
Job Control
• Foreground jobs
• Background jobs
• Multiple terminals
The Shell as
Programming Language
• Shell variables
• Environment variables
– System path
Shell
Scripts
• What is a shell script?
– Writing a shell script
– Running a shell script
– The dot command
• Shell scripts and the search path
Subshells
• Running scripts
• Local variables
More Shell
Script Constructions
• I/O for shell scripts
– Terminating shell scripts
• Conditionals
• Loops
Summary
 Use shell wildcards, command history, file name
completion, and job control
 View and set environmental variables
 Work with subshells and local shell variables
 Write simple shell scripts
Lesson 7:
Customizing Your
Logon Environment
© 2001 ComputerPREP, Inc. All rights reserved.
Objectives
• Edit the shell startup files to customize your
working environment
• Set up command aliases to create shortcuts
• Modify the shell's default behavior by setting shell
options
• Customize the logon shell by installing an
undelete utility
Startup Files
• Standard initialization file
• Personal logon initialization file
• Environment initialization file
The
Terminal Interface
• Controls your terminal's treatment of special
characters
Shell
Options
• Using set -o
• Using set +o
• Command aliases
The
Safedelete Utility
• safedelete: deletes files and directories
• undelete: recovers files and directories
The Red Hat
Package Manager
• Obtaining the proper RPM
• Installing an RPM
Summary
 Edit the shell startup files to customize your
working environment
 Set up command aliases to create shortcuts
 Modify the shell's default behavior by setting shell
options
 Customize the logon shell by installing an
undelete utility
Lesson 8:
Introduction to the
X-Window System
© 2001 ComputerPREP, Inc. All rights reserved.
Objectives
• Describe the main features of the
X-Window system
• Differentiate between X and window managers
• Start X from the command line and use basic
window operations
• Use basic X client programs
• Use X resources to customize window appearance
• Conduct remote X-Window sessions
What Is X-Window?
•
•
•
•
X servers
X clients
Window managers
Desktops
Running X-Window
• Standard Gnome menus
• Starting X clients in the background
• X resources
Remote
X-Window Sessions
• Conducting a remote X session
• xhost commands
Summary
 Describe the main features of the
X-Window system
 Differentiate between X and window managers
 Start X from the command line and use basic
window operations
 Use basic X client programs
 Use X resources to customize window appearance
 Conduct remote X-Window sessions
Linux
Fundamentals




UNIX and Linux Basics
Files and Directories
Text Editing with Vi, Emacs, and Pico
An Arsenal of Linux Commands
Linux
Fundamentals




I/O Redirection and Filters
Working with the Shell
Customizing Your Logon Environment
Introduction to the X-Window System