Beruflich Dokumente
Kultur Dokumente
RHCE ~
Red Hat Certified Engineer
Author :
Momen Hany
2012
RHCE
F
N
P
L
Welcome in
RH033 - Red Hat Linux Essentials
RHCE
Contents
F
N
P
L
Copyright
Unit1:History For UNIX & LINUX
Unit2:Linux Environment
Unit3:Using The System
Unit4:Working with Files and Directories
Unit5:File and Directory Permissions
Unit6:Linux Documentation & Help
Unit7:Tour Through Linux
Unit8:Editing Files
Unit9:Shell Basics
Unit10:Working with Processes
Unit11:Linux Utilities
Unit12:Shell Scripting
Unit13:Linux GUI
Unit14:Basic System Configuration Tool
Certification Information
Copyright
F
N
P
L
RHCE
F
N
P
L
F
N
P
L
Unit1:
History For UNIX & LINUX
Module Overview
F
N
P
L
o What is O.S ?
o What is Kernel ?
o UNIX History ?
o LINUX History ?
o What about Red Hat ?
o Linux Distributions .
Operation System
F
N
P
L
Hardwar
O.S
Kernel
F
N
P
L
http://www.kernel.org/
UNIX History
F
N
P
L
Year
Event
1957
Bell Labs found they needed an operating system for their computer center
that at the time was running various batch jobs. The BESYS operating
system was created at Bell Labs to deal with these needs.
1965
Bell Labs was adopting third generation computer equipment and decided
to join forces with General Electric and MIT to create Multics (Multiplexed
Information and Computing Service).
1969
1969
1969
UNIX History
F
N
P
L
Year
Event
1971
First edition of Unix released 11/03/1971. The first edition of the "Unix
PROGRAMMER'S MANUAL [by] K. Thompson [and] D. M. Richard Stallman.
It includes over 60 commands like: b (compile B program); boot (reboot
system); cat (concatenate files); chdir (change working directory); chmod
(change access mode); chown (change owner); cp (copy file); ls (list
directory contents); mv (move or rename file); roff (run off text); wc (get
word count); who(who is one the system). The main thing missing was
pipes. (GNU Project)
1972-1975
1977
----
LINUX History
F
N
P
L
Year
Event
1991
--
1994
-----
Red Hat , Caldera, and some other companies gained substantial amount of
response from the users worldwide. While these were commercial ventures,
dedicated computer programmers created their very own volunteer-based
distribution, the famed Debian. With the new Graphical User
Interfaces (like X-window System, KDE, GNOME)the Linux
distributions became very popular.
Red Hat
F
N
P
L
Best Company in the world introduced Linux Red Hat and Fedora O.S Dist.
That has Support and Training for Red hat products .
http://www.redhat.com/about/company/history.html
Linux Distributions
Famous Dist.
F
N
P
L
http://distrowatch.com/
By Eng Momen Hany
F
N
P
L
RHCE
F
N
P
L
F
N
P
L
Unit2:
Linux Enveronment
Module Overview
o Linux 4 User & Linux 4 Servers .
F
N
P
L
o File Structure .
o Shell Prompt .
o Disk & Partitioning .
o Install Red Hat Enterprise 6 .
*Master Boot Record (MBR)+Dual Boot.
F
N
P
L
File Structure
F
N
L
/
root
home
Admin
Home
Directory
User
Home
Directory
usr
dev
mnt
etc
Other
Mount
Devices
System
Executable
Files
Special
Files For
Devices
var
Variable
Files
Service
Config
Files
boot
bin
sbin
User
Executable
Files
Boot Files
MBR
opt
Third
Party App
Admin
only
Executable
Files
Shell
Shell Name
Ash
Author
Kenneth
Almquist
Binary
ash
Default
Prompt
Bourne
Bash (Bourne
Again)
Korn
Brian
Fox/Chet
Ramey
Eric Gisin
sh
Bash
ksh
F
N
C-shell
P
L
T-shell
Zsh
William Joy
Paul Falstad
csh
tcsh
zsh
F
N
P
L
SWAP Partition
Installation
F
N
P
L
Go To Lab
Window System
F
N
P
L
F
N
P
L
F
N
P
L
RHCE
F
N
P
L
F
N
P
L
Unit3:
Using The System
Module Overview
o Log in and out of the system.
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
Command Prompt
Examples:
[user@host ~]$
[root@host ~]#
$
#
The dollar ($) usually means: "logged in as regular user"
The hash (#) usually means: "logged in as root"
F
N
P
L
F
N
P
L
WRONG
RIGHT
1. Separation
1. Separation
$ mail -f personal
$ who -u
$ mail - f personal
$ who-u
2. Order
2. Order
3. Multiple options
3. Multiple options
$ who -m -u
$ who mu
$ who -m-u
$ who -m u
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
<backspace>, <ctrl-h>
<ctrl-c>
Corrects mistakes
Terminates the current
command and returns to the shell
<ctrl-d>
<ctrl-s>
End of transmission
Temporarily stops output to the
screen
Resumes output
Erase last word
Erase the entire line
Command or filename
completion
<ctrl-q>
<ctrl-w>
<ctrl-u>
<tab>
F
N
P
L
<arrow up>
<arrow down>
<arrow left>
<arrow right>
<shift page-up>
<shift page-down>
<Ctrl-R>
Previous command
Next command
One character to the left
One character to the right
Look at the output of previous
commands
F
N
P
L
F
N
P
L
Command History
_______________
Command history also can be viewed with history command
$ history 5
99 clear
999 wc .bash_profile
1000 wc .bash_profile
1001 wc .bash_profile
1000 history
F
N
P
L
Go To Lab
F
N
P
L
RHCE
F
N
P
L
F
N
P
L
Unit4:
Working with Files and Directories
Module Overview
F
N
P
L
F
N
P
L
F
N
P
L
Linux Filenames
_______________
Should be descriptive of the content
Should use only alphanumeric characters:UPPERCASE, lowercase,
number, @, _
Should not include embedded blanks
Should not contain shell metacharacters:* ? > < / ; & ! [ ] | \ ' " ( ){}
Should not begin with + or - sign
Are case-sensitive
Filenames starting with a . are hidden
The maximum number of characters for a filename is 255
By Eng Momen Hany
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
File Link
________
File Link Type:
Hard Link you can store mirrored file in another location that
has every changed in the master file File Synchronization
Foul tolerance
Sof Link as short cut file
$ ln file1 /home/user1/file1 you can create with different name (Hard Link)
$ ln file1-s /home/user file1 (Soft Link)
By Eng Momen Hany
F
N
P
L
File Details
_________
$ wc file1
F
N
P
L
$ less File1
$ more File1
Displaying Binary Files
___________________
With the od command
$ od File1 Display File as Binary
$ od -c File1 Display File as Decimal
$ od h File1 Display File as Hexadecimal
By Eng Momen Hany
Splitting File
F
N
P
L
Splitting Files
___________
You can split a file into a smaller files with the split command
split -b <Bytes> file [prefix]
$ Split b 1024 File1 Filexs Split File1 to more Files each spitted File is <1024>
F
N
P
L
RHCE
F
N
P
L
F
N
P
L
Unit5:
File and Directory Permissions
Module Overview
F
N
P
L
F
N
P
L
Access Level
Permission
Group
Other
File Permi
Type -ssion
Size
Link
Counter
Group
Modification
Time
Name
F
N
P
L
r read
w write
x execute
regular files:
r file is readable
w file is writeable
x file is executable ( if in an executable format )
directories:
r contents of directory can be listed (ls)
w contents can be modified (add/delete files)
x change into directory is possible (cd)
F
N
P
L
$ ls l
-rw-r--r-- 1 user2 sales 171 Jun 4 10:23 file2
drwxr-xr-x 2 user1 hr 512 Jun 7 11:13 mydir
F
N
P
L
Assign Permission
Symbolic Method
F
N
P
L
+ add permission
- Remove Permission
group
rwx
421
------7
other
rwx
42 1
------7 =Full Control 4 (U+G+O)
F
N
P
L
R 22
=4
W 21
=2
X 20
=1
- 0
=0
--------------------7
F
N
P
L
777
022
F
N
P
L
Example:I need when create any new Directory the default permission is { rw- r r--} (644)
Net permission Full permission = umask
644
777
= 133
? UMASK is 133
$ umask 133
By Eng Momen Hany
F
N
P
L
022
F
N
P
L
RHCE
F
N
P
L
F
N
P
L
Unit6:
Linux Documentation & Help
Module Overview
F
N
P
L
F
N
P
L
F
N
P
L
NAME
finger - user information lookup program
SYNOPSIS
finger [-lmsp] [user ...] [user@host]
DESCRIPTION
The finger command displays information
about the system users.
Options are:
-s Finger displays the user's login name,: :
F
N
P
L
_________________________________
1. User commands
2. System calls
3. Libc calls
4. Devices
5. File formats and protocols
6. Games
7. Conventions, macro packages and so forth
8. System administration
9. Kernel
Certain subjects appear in multiple sections
To select correct section, add section number:
man 1 passwd (about the passwd command)
man 5 passwd (about the passwd file)
By Eng Momen Hany
F
N
P
L
F
N
P
L
______________________
F
N
P
L
$ who --help
Usage: who [OPTION]... [ FILE | ARG1 ARG2 ]
-h, --heading print line of column headings
-m only hostname and user
associated with stdin
-q, --count all login names and number of
users logged in
--help display this help and exit
--version output version information and exit
F
N
P
L
$ whatis pwd
F
N
P
L
Usually stored in
/usr/share/doc/<programname>
F
N
P
L
RHCE
F
N
P
L
F
N
P
L
Unit7:
Tour Through Linux
Module Overview
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
/Boot
_____
The /boot directory contains the kernel images, some other things
related to these images
and the files needed for the bootloader (LILO or GRUB).
F
N
P
L
/dev
____
Contains special files that represent hardware devices
Block special device, for example, a hard disk
Character special device, for example, mouse and
keyboard
F
N
P
L
/etc
___
Contains system-wide configuration files
Some subsystems have multiple files and therefore use a separate directory
/etc/X11 contains X Window System configuration
/etc/skel contains default user configuration files
/etc/sysconfig contains system configuration
F
N
P
L
/home
_____
Home directories of users
F
N
P
L
/mnt
____
Mount points for other filesystems
F
N
P
L
/proc
_____
Virtual filesystem
Represents kernel and process information
F
N
P
L
/root
____
Home directory of the root user
F
N
P
L
/tmp
____
Temporary storage space for programs, users
Usually automatic cleanup mechanism active
F
N
P
L
/usr
___
UNIX System Resources
Contains all programs, libraries and so on which are not
essential for system boot and emergency operations
/usr/local intended for programs not in the distribution
Locally developed
Locally compiled
F
N
P
L
/var
____
Files of variable size
Logfiles
Lockfiles
Directories with variable content
Mail
Scheduling
Printing
Temporary storage space, longer than /tmp
F
N
P
L
/lost+found
__________
Exists in every filesystem
Place where lost+found files are stored after a crash recovery by fsck.
F
N
P
L
Other Directories in /
____________________
/opt: used for some software from external providers
Separate filesystem advisable
Whatever you create yourself.
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
RHCE
F
N
P
L
F
N
P
L
Unit8:
Editing Files
Module Overview
F
N
P
L
F
N
P
L
Editing Files
__________
Use file command to determine the content of a file
To edit text files, use an editor
Non-text files can only be changed using the application
that created them, or with a hex editor
But most configuration files under Linux are text files
$ file /etc/passwd
F
N
P
L
F
N
P
L
vi Modes
vi knows three modes of operation
Command mode (for simple, one-letter commands)
Edit mode (insert text)
ex mode (for complicated commands)
Can easily change between modes
F
N
P
L
$ vi myfile.txt
Cursor Movement in Command Mode
_________________________________
F
N
P
L
F
N
P
L
F
N
P
L
Replacing Patterns
_________________
Advanced search and replace can be done in ex mode:
To replace old with new: :1,$s /old/new/g
F
N
P
L
Exiting vi__
F
N
P
L
F
N
P
L
Other Editors
___________
A typical Linux distribution comes with a large number of editors.
Examples:
Text mode editors
pico (really simple)
Original vi
emacs (even more powerful and complicated than vi)
Graphical mode editors
kedit, kwrite
gedit
Hex editors allow you to change non-text files if you know the
internal structure
khexedit
F
N
P
L
RHCE
F
N
P
L
F
N
P
L
Unit9:
Shell Basics
Module Overview
F
N
P
L
o
o
o
o
o
o
o
o
F
N
P
L
The Shell
The "shell" is the user interface to Linux
F
N
P
L
F
N
P
L
F
N
P
L
File Descriptors
Every program has a number of file
descriptors associated with it
Three descriptors are assigned by the shell
when the program starts (STDIN,
STDOUT and STDERR)
Other descriptors are assigned by the
program when it opens files
F
N
P
L
Input Redirection
STDIN redirected from file:
$ cat < file1
Hi
Welcome
Etc
F
N
P
L
Output Redirection
$ ls > fileb
F
N
P
L
Error Redirection
$ ls-l 2> errorfile
$ cat errorfile
Ls-l command not found
---------------------------------------------------------------Redirect and append errors to a file:
F
N
P
L
Pipes
A sequence of two or more commands separated by a
vertical bar (|) is called a pipe or pipeline
$ ls l | wc -l
F
N
P
L
Common Filters
expand, unexpand: Change tabs to spaces and vice versa
sed: Allows string substitutions
awk: Pattern scanning and processing
fmt: Insert line wraps so text looks pretty
tac: Display lines in reverse order
tr: Substitute characters
grep: Only displays lines that match a pattern
nl: Number lines
pr: Format for printer
sort: Sort the lines in the file
$ tr filea
By Eng Momen Hany
F
N
P
L
Split Output
The tee command reads standard input and sends the
data to both standard out and a file.
$ ls | tee ls1.save | wc -l
3
$ cat ls1.save
file1
file2
file3
F
N
P
L
Command Substitution
Command Substitution allows you to use the output of a command
as arguments for another command.
F
N
P
L
Command Grouping
Multiple commands can be entered on the same line,
separated by a semicolon (;)
$ echo my date is ; date ; cat filea ; ls
$ date ; pwd
F
N
P
L
Shell Variables
Variables are part of the environment of a process A variable has an unique name The
first character must not be a digit
To assign a value to a variable use:
variable=value
$ VAR1=Welcome in Linux
$ echo $VAR1
Welcome in Linux
$ VAR2=50
$ echo $VAR2
50
F
N
P
L
$ x=6
$ echo my number is $x
My number is $x
$ echo my number is $x
My number is 6
F
N
P
L
F
N
P
L
Use aliases
F
N
P
L
Aliases
The alias command allows you to set up aliases for often-used commands
Examples:
$ alias ll='ls -l'
$ alias rm='rm -i'
Create Scripts
F
N
P
L
$ vi momenscript
>ls
>date
:wq
--------------------------------------------------------------------------------$ chmod 700 momenscript
$ ls l
momenscript
$ bash momenscript
$ source momenscript
$ sh momenscript
$ . momenscript
F
N
P
L
RHCE
F
N
P
L
F
N
P
L
Unit10:
Working with Processes
Module Overview
F
N
P
L
F
N
P
L
What Is a Process?
A program is an executable file
A process is a program which is being executed
Each process has its own environment:
F
N
P
L
F
N
P
L
Monitoring Processes
The ps command displays process status information
F
N
P
L
F
N
P
L
Starting
Processes
Foreground
Processes
Background
Processes
F
N
P
L
Foreground Processes
$ find / -name README
Foreground processes are invoked by simply typing a command at
the command line.
Background Processes
$ find / -name README &
Background processes are invoked by putting an "&" at
the end of the command line.
F
N
P
L
F
N
P
L
$ kill -9 5698
F
N
P
L
Run command
Logout from system
login to system
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
RHCE
F
N
P
L
F
N
P
L
Unit11:
Linux Utilities
Module Overview
F
N
P
L
o
o
o
o
o
o
o
o
o
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
Options:
-c root$ get but root must existing in last line
-c root^ get but root must existing in first line
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
$ file /etc/passwd
$ file /lib/cpp
F
N
P
L
F
N
P
L
(3)
$ join one two
A xxx yyy
B xxx yyy
C xxx yyy
-------------------------------------------------------------------------------------Output this value
$ join one two > mergedfile
F
N
P
L
F
N
P
L
RHCE
F
N
P
L
F
N
P
L
Unit12:
Shell Scripts
Module Overview
F
N
P
L
o Create a Scripts
Create Scripts
F
N
P
L
$ vi momenscript
>ls
>date
:wq
--------------------------------------------------------------------------------$ chmod 700 momenscript
$ ls l
momenscript
$ bash momenscript
$ source momenscript
$ sh momenscript
$ . momenscript
F
N
P
L
RHCE
F
N
P
L
F
N
P
L
Unit13:
Linux GUI
Module Overview
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
X Components
An X Server
An X Client
Is for instance an application
Receives keyboard and mouse inputs from server
Sends output to be displayed to server
A Window Manager
Is a special X Client
Performs "windows dressing" on other clients
Allows other client windows to be moved, iconified and so forth
By Eng Momen Hany
F
N
P
L
XFree86 Configuration
XFree86 needs to be configured for your hardware
Keyboard
Mouse
Graphical adapter
Monitor
Things to configure: refresh rate, resolution, color depth
Config file: /etc/X11/XF86Config
F
N
P
L
X Servers in Linux
Most distributions use XFree86 (www.xfree86.org) as their X Server
Open Source
Supports most video adapters
F
N
P
L
Desktop Environments
Examples:
GNOME (GNU Network Object Model Environment)
KDE (K Desktop Environment)
F
N
P
L
F
N
P
L
RHCE
F
N
P
L
F
N
P
L
Unit14:
Basic System Configuration Tool
Module Overview
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
RPM
Red hat Package Management
F
N
P
L
You can Donwload any RPM pachage using Linux Tools such as , wget :
F
N
P
L
F
N
P
L
Configure a printer
F
N
P
L
F
N
P
L
F
N
P
L
F
N
P
L
Certification Information
The Red Hat (http://www.redhat.com) is the distributor of Red Hat Linux,
one of the leading commercial Linux distributions. As part of their service
organization they have developed their own education leading to the Red
Hat Certified Technician and Red
Hat Certified Engineer exams. In contrast to the other Linux exams, the
RHCT and RHCE exams are performance based, which means that the
examinee takes place behind an actual Red Hat Linux system and needs to
demonstrate his/her skills on this system. The practical components of the
RHCT exam takes about 2.5 hours, while the practical components of the
RHCE exam take about five hours.
--------------------------------------------------------------------------------------- Linux Professional Institute (http://www.lpi.org) is an organization run by
volunteers with the sole purpose of implementing a vendor-neutral
certification program for Linux. They are sponsored by a number of Linuxrelated companies, among which IBM. The certification tests are delivered
by VUE (Virtual University Enterprises) (http://www.vue.comLPI aims to
implement three levels of certification, of which the first two levels are
currently ready.
By Eng Momen Hany
F
N
P
L
Certification Information
UnitedLinux (the consortium of Linux distributors SUSE, SCO,
TurboLinux and Conectiva, http://www.unitedlinux.com) has announced a
UnitedLinux certification, which will be an extension of the LPI
certification.
---------------------------------------------------------------------------------------------- CompTIA (http://www.comptia.org) is the organization that has, in the past,
already developed a number of certifications that are aimed mostly at
helpdesk personnel and hardware engineers. Recently CompTIA introduced
the Linux+ exam, which is aimed at Linux Professionals with 6 months of
experience with Linux. CompTIA tests are also delivered by VUE, and by
Prometric (http://www.prometric.com).
F
N
P
L
Certification Information
F
The LX02 (Linux Power User) is the entry course in the IBM/Linux curriculum. Its N P
aim is to teach a Linux novice to install and configure Linux so that he/she is able to
L
run Linux on
his/her personal workstation or home system in an environment that is mostly based
on MS-Windows.
The LX03 (Linux System Administration I: Implementation) is the main system
administration course. Its aim is to teach a Linux user the techniques and practices
used in installing, configuring, running and maintaining a Linux-based server.
The LX07 (Linux Network Administration I: TCP/IP and TCP/IP Services) is the
main
network administration course. Its aim is to teach a Linux system administrator how
to configure TCP/IP and various TCP/IP services that run on Linux.
The LX22 (Linux Perl Programming) is the course that covers Perl programming.
The LX23 (Linux Bash Programming) is the course that covers Bash shell
programming and the various programs that are typically used in shell programs,
such as grep, awk and sed.
Certification Information
F
The LX24 (Linux Network Administration II: Network Security and Firewalls)
covers the configuration of a full-function firewall under Linux. As such, it also
covers a number of
security aspects of Linux that are not particularly related to firewalls, but apply to
any networked system.
The LX25 (Linux as a Web server - Apache) is the course which covers Apache,
the most commonly used Web server on Linux and other UNIX platforms.
The LX26 (Linux integration with Windows - Samba) is the course which covers
Samba, the product which emulates a networked Windows NT server to the network.
P
L
Certification Information
F
N
P
L
F
N
P
L
F
N
P
L
White Board
Last Viewed