220
RHCE RHCE ~ Red Hat Certified Engineer Administration I - Essential Book Author : Mo‟men Hany © 2012 Copyright © March 2012 , Engineer Mo‟men Hany Mohamed

0-Rhce Essential Book by Eng Mo'Men Hany

Embed Size (px)

DESCRIPTION

Tutorial

Citation preview

Page 1: 0-Rhce Essential Book by Eng Mo'Men Hany

RHCE

RHCE ~

Red Hat Certified Engineer

Administration I - Essential Book Author :

Mo‟men Hany ©

2012 Copyright © March 2012 ,

Engineer Mo‟men Hany Mohamed

Page 2: 0-Rhce Essential Book by Eng Mo'Men Hany

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Welcome in

Copyright © March 2012 ,

Engineer Mo‟men Hany Mohamed

Page 3: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany ©

RH033 - Red Hat Linux Essentials

RHCE

Contents 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 Basic‟s

Unit10:Working with Processes

Unit11:Linux Utilities

Unit12:Shell Scripting

Unit13:Linux GUI

Unit14:Basic System Configuration Tool

Certification Information

N P

F

L

Copyright © March 2012 ,

Engineer Mo‟men Hany Mohamed

Page 4: 0-Rhce Essential Book by Eng Mo'Men Hany

Copyright

N P

F

L

The contents of this book are copyright © March 2012 ,

Engineer Mo‟men Hany Mohamed.

Does not allow the amendment in this book , A free copy

of any one.

The Instructors also have the right to be assisted

in this book in their own explanations and labs.

Been used to create this book with Eng.M-Hany

Experience , IBM, red hat and general books.

Contact book owner : -

Mobil: (Egypt) +2 011 437 395 45

Email: [email protected]

http://www.facebook.com/MomenHanyFP

Copyright © March 2012 ,

Engineer Mo‟men Hany Mohamed By Eng Mo‟men Hany ©

Page 5: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Page 6: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Unit1:

History For UNIX & LINUX

N P

F

L

Page 7: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Module Overview

o What is O.S ?

o What is Kernel ?

o UNIX History ?

o LINUX History ?

o What about Red Hat ?

o Linux Distribution‟s .

N P

F

L

Page 8: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Operation System

An operating system is a program designed to run other

programs on a computer. A computer‟s operating system is its

most important program. It is considered the backbone of a

computer, managing both software and hardware resources.

Hardwar O.S

N P

F

L

Page 9: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Kernel

• kernel is the central core of operating system.

• it does not interact with user , rather it interact with shell as well as with

hardware devices.

http://www.kernel.org/

N P

F

L

Page 10: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

UNIX History

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 Withdrawn Ken Thompson and Dennis Ritchie needed to rewrite an

operating system in order to play space travel on another smaller machine,

The result was a system that a punning colleague called UNICS (UNiplexed

Information and Computing Service)

1969 Summer 1969 Unix was developed.

1969 Linus Torvalds is born.

N P

F

L

Page 11: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

UNIX History

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 Second to Sixth edition of Unix released.

1977 1BSD released late 1977.

1978 -1980 2-4BSD released mid.

1985 Eighth edition of Unix released February 1985.

---- More “SGI-Ultrix-HP-UX-Ninth-Sun-IBM For IAX-NetBSD -..”

N P

F

L

Page 12: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

LINUX History

Year Event

1991 Linux is introduced by Linus Torvalds, a student in Finland.

That was Developed Linus to Support (Multi Tasking ) woooooo.

-- It was licensed under GNU General Public License(GPL), thus ensuring

that the source codes will be free for all to copy, study and to change.

Students and computer programmers grabbed it.

1994 Red Hat Linux is introduced.

----- 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.

N P

F

L

Page 13: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Red Hat

http://www.redhat.com/about/company/history.html

Best Company in the world introduced Linux Red Hat and Fedora O.S Dist.

That has Support and Training for Red hat products .

N P

F

L

Page 14: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Linux Distribution‟s

http://distrowatch.com/

Famous Dist. N P

F

L

Page 15: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 16: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Page 17: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Unit2:

Linux Enveronment

N P

F

L

Page 18: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Module Overview

o Linux 4 User & Linux 4 Server‟s .

o File Structure .

o Shell Prompt .

o Disk & Partitioning .

o Install Red Hat Enterprise 6 .

*Master Boot Record (MBR)+Dual Boot.

o Window System “Desktop” .

o Virtual Consoles and Graphic Console .

N P

F

L

Page 19: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Client & Server Environment‟s

● Linux

Distribution‟s

are OS‟s based on the Linux kernel.

● Red Hat Enterprise Linux

• Stable, thoroughly tested software.

• Professional support services.

• Centralized management tools for large networks.

● The Fedora Project

• More, newer applications.

• Community supported (no official Red Hat support).

• For personal systems.

N P

F

L

Page 20: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

File Structure

/

root home usr dev mnt etc var boot bin sbin opt

Admin

Home

Directory

User

Home

Directory

System Executable

Files

Special

Files For

Devices

Other

Mount

Devices

Service

Config

Files

Variable

Files

Boot Files

“MBR”

User

Executable

Files

Admin

only

Executable

Files

Third

Party App

N P

F

L

Page 21: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Shell Shell Name Ash Bourne Bash (Bourne

Again)

Korn C-shell T-shell Zsh

Author Kenneth

Almquist

Brian

Fox/Chet

Ramey

Eric Gisin William Joy Paul Falstad

Binary ash sh Bash ksh csh tcsh zsh

Default

Prompt $ $ $ % %

N P

F

L

Page 22: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Disk & Partitioning

Primary v.s Extended

Linux File System

Partition Leased

SWAP Partition

N P

F

L

Page 23: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Installation

Go To Lab

Install Linux O.S Red Hat & Fedora :-

N P

F

L

Page 24: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Window System

Two desktop environments provided by Red Hat:

• GNOME: the default desktop environment.

• KDE: an alternate desktop environment.

Note:-

“A typical Linux system will run six virtual

consoles and one graphical console”

N P

F

L

Page 25: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Virtual Consoles and Graphic

Console

Switch among virtual consoles by typing: Ctrl-Alt-F[1-6]

Access the graphical console by typing: Ctrl-Alt-F7

N P

F

L

Page 26: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 27: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Page 28: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Unit3:

Using The System

N P

F

L

Page 29: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Module Overview

o Log in and out of the system.

o State the structure of Linux commands.

o Execute basic Linux commands.

o Change your password.

o Use the command history.

o Use the keyboard and mouse effectively.

N P

F

L

Page 30: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Log in and out of the system

Linux is Multi-user and Multitasking

Linux is a multi-user, multitasking operating system

Multiple users can run multiple tasks simultaneously, independent

of each other.

Always need to "log in" before using the system

Identify yourself with username, password

Multiple ways to log in to the system

• Console: Directly attached keyboard, mouse, monitor

• Serial terminal

• Network connection

N P

F

L

Page 31: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Log in and out of the system N P

F

L

Page 32: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Log in and out of the system

Switching between virtual consoles and the graphical

environment

● A typical Linux system will run six virtual

consoles and one graphical console

• Server systems often have only virtual consoles

• Desktops and workstations typically have both

● Switch among virtual consoles by typing:

Ctrl-Alt-F[1-6]

● Access the graphical console by typing Ctrl-

Alt-F7

N P

F

L

Page 33: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

State the structure of Linux commands

Command Prompt

Examples:

[user@host ~]$

[root@host ~]#

$

#

• The dollar ($) usually means: "logged in as regular user"

• The hash (#) usually means: "logged in as root"

N P

F

L

Page 34: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

State the structure of Linux commands

Linux Command Syntax

$ command option(s) argument(s)

$ ls just command

$ ls -l command and option

$ ls /dev command and argument

$ ls -l /dev command, option and argument

$ ls –I I node , index number of file

N P

F

L

Page 35: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

State the structure of Linux commands

RIGHT 1. Separation $ mail -f personal

$ who -u

2. Order $ mail -s test root

$ who -u

3. Multiple options $ who -m -u

$ who –mu

WRONG 1. Separation $ mail - f personal

$ who-u

2. Order $ mail test root -s

$ -u who

3. Multiple options $ who -m-u

$ who -m u

Command Format Examples

N P

F

L

Page 36: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Execute basic Linux commands

passwd: Change your password

mkpasswd: Generate a random password

date, cal: Find out today's date and displays a calendar

who, finger: Find out who else is active on the system

clear: Clear the screen

echo: Write a message to your own screen

write: Write a message to other screens

wall: Write a message to all screens

talk: Talk to other users on the system

mesg: Switch on/off reception of write, wall and talk messages

N P

F

L

Page 37: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Execute basic Linux commands

The date Command

__________________

date shows the current date and time

$ date

Fri Jun 6 11:15:10 CET 2003

N P

F

L

Page 38: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Execute basic Linux commands

The cal Command

________________

cal shows a calendar

Synopsis: cal [Month] [Year]

$ cal 6 2003

June 2003

Su Mo Tu We Th Fr Sa

1 2 3 4 5 6 7

8 9 10 11 12 13 14

15 16 17 18 19 20 21

22 23 24 25 26 27 28

29 30

$

N P

F

L

Page 39: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Execute basic Linux commands

Who Is on the System

_____________________

who shows who is logged onto the system

$ who

root tty1 Mar 5 11:10

User1 tty2 Mar 5 11:04

$ who am i

host!User1 tty2 Mar 5 11:04

But:

$ whoami

user1

N P

F

L

Page 40: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Execute basic Linux commands

Finding Information about Users

_____________________________

The finger command shows info about other users

Synopsis: finger [user][@host]

$ finger

Login Name Tty Idle Login Time

User1 Tux (1) 2 Mar 5 11:04

root root *1 7 Mar 5 11:10

$ finger User1

Login: User1 Name: Tux (1)

Directory: /home/User1 Shell: /bin/bash

On since Fri Mar 5 11:04 (CET) on tty2

No mail.

No plan.

N P

F

L

Page 41: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Execute basic Linux commands

The clear, echo, write, and wall Commands

_______________________________________

The clear command clears your screen

$ clear

The echo command writes messages to your own screen

$ echo Who wants to go to lunch?

Who wants to go to lunch?

Use write to display a text message on a user's terminal

$ write user2

Message

<ctrl-d>

Use wall to place a message on all logged in user's displays

$ wall

I'm back

<ctrl-d>

N P

F

L

Page 42: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Execute basic Linux commands

Talk with Another User

_____________________

If Ahmed wants to talk with Momen, Ahmed enters:

$ talk Momen

If Momen also wants to talk with Ahmed, Momen enters:

$ talk Ahmed

N P

F

L

Page 43: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Execute basic Linux commands

The mesg Command

The mesg command controls whether other users can send

messages to you with the write, wall or talk command or through

output redirection.

User User1 at user1:

$ mesg n

User User1 at User2:

$ write User1

User1 write: User1 has disabled messages on User1

$ mesg y

N P

F

L

Page 44: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Execute basic Linux commands

• <backspace>, <ctrl-h>

• <ctrl-c>

• <ctrl-d>

• <ctrl-s>

• <ctrl-q>

• <ctrl-w>

• <ctrl-u>

• <tab>

• Corrects mistakes

• Terminates the current

command and returns to the shell

• End of transmission

• Temporarily stops output to the

screen

• Resumes output

• Erase last word

• Erase the entire line

• Command or filename

completion

N P

F

L

Page 45: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Execute basic Linux commands

• <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

• Look at the output of later

commands; eventually gets youback

to the command prompt

• Search for a command in

thecommand history

N P

F

L

Page 46: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Change your password

To change your password using GNOME,

navigate to System->Preferences->About Me

and then click Password.

● To change your password from a terminal:passwd

N P

F

L

Page 47: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Use the command history

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

$ !! Run last command

$ !-3 Run last 3 command

N P

F

L

Page 48: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Use the keyboard and mouse effectively

Go To Lab

N P

F

L

Page 49: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 50: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Page 51: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Unit4:

Working with Files and Directories

N P

F

L

Page 52: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Module Overview

o Describe the different file types

o Describe file and pathnames

o Create, delete, copy, move and list directories

o Create, delete, copy and move files

o View the content of both text and binary files

N P

F

L

Page 53: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the different file types N P

F

L

Page 54: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the different file types

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

N P

F

L

Page 55: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Absolute and Relative Pathnames

______________________________

Absolute pathnames

• Begin with a forward slash “/”

• Complete "road map" to file location

• Can be used anytime you wish to specify a file name

Relative pathnames

• Do not begin with a slash

• Specify location relative to your current working directory

• Can be used as a shorter way to specify a file name

Describe file and pathnames N P

F

L

Page 56: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Current Working Directory

_______________________

● Each shell and system process has a

current

working

directory (cwd)

● pwd

Displays the absolute path to the shell's cwd

Describe file and pathnames N P

F

L

Page 57: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Create, delete, copy, move and list

directories

Change Current Directory

_________________________

With the cd (change directory) command:

$ cd dir_name

$ cd doc (relative)

$ cd /home/user1/doc (full& absolute)

$ cd ~user1/doc (home)

$ cd (Go to your home directory)

$ cd .. (Go one directory up)

$ cd - (Go to previous directory)

N P

F

L

Page 58: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Create, delete, copy, move and list

directories

Listing Directory Contents

● Lists the contents of the current directory or a specified

directory

● Usage:

• ls [options] [files_or_dirs]

● Example:

• ls -a (include hidden files)

• ls -l (display extra information)

• ls -R (recurse through directories)

• ls -ld (directory and symlink information)

N P

F

L

Page 59: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Create, delete, copy, move and list

directories

Working with Multiple Directories

_____________________________

Create and remove multiple directories simultaneously with the –p flag

$ mkdir -p dir1/dir2/dir3

$ rmdir -p dir1/dir2/dir3

$ rmdir doc test

rmdir: doc: Directory not

$

directory must be empty!

N P

F

L

Page 60: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Create, delete, copy and move

files

The touch Command __________________

The touch command creates an empty file, or updates the

modification time of an existing file.

$ ls -l

-rw-rw-r-- 1 tux1 penguins 512 Feb 24 11:10 docs

$ touch docs

$ ls -l

-rw-rw-r-- 1 tux1 penguins 512 Mar 5 15:37 docs

$ touch new

$ ls -l

-rw-rw-r-- 1 tux1 penguins 512 Mar 5 15:37 docs

-rw-rw-r-- 1 tux1 penguins 0 Mar 5 15:37 new

N P

F

L

Page 61: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Create, delete, copy and move

files

Remove File or Directory __________________

$ rm dir

$ rm –p /dir1/dir2/dir3 Remove more Director's

$ rm –p dir1/dir2/dir3

$ rm –f dir1/dir2/dir3 Force Remove Dir If Empty or no

$ rm –p file1/dir4/file7/dir7

$ rmdir –r dir2 Remove Dire and sub Director's and Files

$ mkdir -p dir1/dir2/dir3

$ rmdir -p dir1/dir2/dir3

N P

F

L

Page 62: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Create, delete, copy and move

files and Directory‟s

Copying Files and Directory's

__________________________

The cp command copies files and directory’s :

cp source[s] [target]

$ cp –r dir1 /home/user1/myfiles

$ cp –r .dir1 /home/user1/myfiles/momendir Copy Hidden Dir with new name

N P

F

L

Page 63: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Create, delete, copy and move

files and Directory‟s

Moving Files and Directory's

_________________________

The mv command move files and directory’s:

. mv <source> <Destination>

$ mv file1 /home/user1

$ mv file1 dir1 /home/user1 Move multi file‟s and Dir

$ mv dir11 /home/user1/dir12 Move Dir with new name

_____________________________________________________

Hide File or Directory‟s

____________________

$ mv file1 .file1

$ mv dir4 .dir4

N P

F

L

Page 64: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Create, delete, copy and move

files

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)

N P

F

L

Page 65: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Create, delete, copy and move

files

Show File Contents

_______________

$ cat File2

--------------------------------------------------------------------------------

File Details _________

$ wc file1 show n of line , carachters , word’s

N P

F

L

Page 66: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

View the content of both text and binary files

Displaying Files Page by Page

__________________________

With the more or less commands:

$ 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

N P

F

L

Page 67: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Splitting File

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>

Join Smaller Files into Large File ____________________________

$ cat filexsa filexsb filexsc >output file name

Or

$ cat filexs* >output file name

N P

F

L

Page 68: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 69: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Page 70: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Unit5:

File and Directory Permissions

N P

F

L

Page 71: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Module Overview

o Explain the Linux security model

o List the permissions required to perform several common

commands

o Change permissions using symbolic and octal notation

o Describe how default permissions are calculated

N P

F

L

Page 72: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Explain the Linux

security model

Access Level Permission

User & Owner Group Other

-rw-r--r-- 1 user2 sales 171 Jun 4 10:23 file2

drwxr-xr-x 2 user1 hr 512 Jun 7 11:13 mydir

File

Type Permi

-ssion

Link

Counter

Owner

Group

Size Modification

Time

Name

N P

F

L

Page 73: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Explain the Linux

security model

Permissions Notation ___________________

rwx rwx rwx

User group other

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)

r read

w write

x execute

N P

F

L

Page 74: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

List the permissions required to perform

several common commands

$ 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

N P

F

L

Page 75: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Change permissions using symbolic and

octal notation

Assign Permission

Symbolic Method Numeric & Octal

Method

N P

F

L

Page 76: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Change permissions using symbolic and

octal notation

Assign Permission by Symbolic Method:-

__________________________________

$ chmod ugo+rwx file1 Full control 4 user group and other

$ chmod a+rwx dir1 Full control 4 user group and other

$ chmod o-wx dir2 Deny permission write and execute to other

+ add permission

- Remove Permission

U = User & Owner

G = Group

O = Other

A = All <u+g+o>

N P

F

L

Page 77: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Change permissions using symbolic and

octal notation

User group other

r w x r w x r w x

4 2 1 4 2 1 4 2 1

------ ------- -------

7 7 7 =Full Control 4 (U+G+O)

R 22 = 4

W 21 = 2

X 20 = 1

- 0 = 0

---------------------

7

Example:-

$ chmod 764 file1

N P

F

L

Page 78: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe how default permissions are

calculated

Any New File

Or Directory

Crated by

default

Has default

permission from

System.

N P

F

L

Page 79: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe how default permissions are

calculated

Dir : 777 - 022 = 755 ( rwx rw- rw-)

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

N P

F

L

Page 80: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe how default permissions are

calculated

Change UMASK using Symbolic Method: ______________________________________

$ umask u=rwx,g=rw,o=r Set umask by symbolic

$ umask –S Show Symbolic umask 4 all users

Note:

If Machine Restarted the umask change to default (022,002)

$ cat /etc/bashrc edit umask in this file by root 4 force umask

constant on all users

umask 022

N P

F

L

Page 81: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 82: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Page 83: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Unit6:

Linux Documentation & Help

N P

F

L

Page 84: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Module Overview

o Describe the use of man

o Describe the use of info

o Describe the use of whatis

o Describe the use of help

o Describe the documentation Location

N P

F

L

Page 85: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the use of man

The man Command

_________________

With the man command you can read the manual page of

commands.

Manual pages are stored in /usr/share/man

The manual page consists of:

Name The name of the command and a one-line description

Synopsis The syntax of the command

Description Explanation of how the command works and what it does

Options An explanation of the options

Files The files used by the command

Bugs Known bugs and errors

See also Other commands related to this one

N P

F

L

Page 86: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the use of man

$ man finger

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,: :

The -k option of the man command or the apropos command

prints

out a description of all entries which match the given keyword

$ man –k print

N P

F

L

Page 87: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the use of man

Manual pages are divided in 9 sections: _________________________________

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)

N P

F

L

Page 88: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the use of man

$ man –a passwd Show command Section page by page

$ man –w passwd Command File Path

$ man –k list search about <list> in entire manual

N P

F

L

Page 89: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the use of Info

The info Command ______________________

Sometimes a replacement for manual pages

Widely used by the GNU project

Information for info is stored in /usr/share/info

Some info commands:

space next screen of text

del or bs previous screen of text

n next node

p previous node

q quit info

/ or s search about word

$ info pwd

N P

F

L

Page 90: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the use of help

The --help Option

________________ Another way of getting help about a command

Help is built in the command itself (if supported)

$ 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

N P

F

L

Page 91: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the use of whatis

The whatis Option

________________ Another way of getting help about a command

$ whatis pwd

N P

F

L

Page 92: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the documentation

Location

Usually stored in

/usr/share/doc/<programname>

N P

F

L

Page 93: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 94: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Page 95: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Unit7:

Tour Through Linux

N P

F

L

Page 96: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Module Overview

o Describe the structure of the filesystem

o Mount and unmount Devices

N P

F

L

Page 97: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the structure of the

filesystem N P

F

L

Page 98: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the structure of the

filesystem

/bin, /lib, /sbin

____________

• /bin contains executables for every user

• /sbin contains system administration executables

• /lib contains libraries

• Should always be available

At system boot

In single user mode

When booting from rescue disk

N P

F

L

Page 99: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the structure of the

filesystem

/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).

N P

F

L

Page 100: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the structure of the

filesystem

/dev ____

Contains special files that represent hardware devices

Block special device, for example, a hard disk

Character special device, for example, mouse and

keyboard

N P

F

L

Page 101: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the structure of the

filesystem

/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

N P

F

L

Page 102: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the structure of the

filesystem

/home

_____

Home directories of users

N P

F

L

Page 103: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the structure of the

filesystem

/mnt ____

Mount points for other filesystems

N P

F

L

Page 104: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the structure of the

filesystem

/proc _____

• Virtual filesystem

• Represents kernel and process information

N P

F

L

Page 105: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the structure of the

filesystem

/root

____

Home directory of the root user

N P

F

L

Page 106: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the structure of the

filesystem

/tmp

____

• Temporary storage space for programs, users

• Usually automatic cleanup mechanism active

N P

F

L

Page 107: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the structure of the

filesystem

/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

N P

F

L

Page 108: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the structure of the

filesystem

/var

____ • Files of variable size

Logfiles

Lockfiles

• Directories with variable content

Mail

Scheduling

Printing

• Temporary storage space, longer than /tmp

N P

F

L

Page 109: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the structure of the

filesystem

/lost+found

__________ • Exists in every filesystem

• Place where lost+found files are stored after a crash recovery by fsck.

N P

F

L

Page 110: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the structure of the

filesystem

Other Directories in /

____________________

• /opt: used for some software from external providers

Separate filesystem advisable

• Whatever you create yourself.

N P

F

L

Page 111: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Mount and unmount Devices

The mount Command

____________________

The mount command mounts a filesystem

Makes it part of the unified filesystem structure

mount [-t type] [-o opts] device mountpnt

$ mount /dev/hda5 /usr

N P

F

L

Page 112: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Mount and unmount Devices

The umount Command

_____________________

The umount command unmounts a filesystem

Takes it out of the unified filesystem structure

Filesystem should not be busy

umount {device|mountpnt}

$ umount /dev/hda5

- OR -

$ umount /usr

N P

F

L

Page 113: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

The /etc/fstab File

_________________

• /etc/fstab lists all known filesystems on the system

Mount and unmount Devices N P

F

L

Page 114: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 115: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Page 116: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Unit8:

Editing Files

N P

F

L

Page 117: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Module Overview

o Determine the type of file using file

o Edit text files with vi

o Discuss other text file editors such as kedit

N P

F

L

Page 118: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Determine the type of file using file

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

N P

F

L

Page 119: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Edit text files with vi

The vi text editor

______________ • Default editor in all UNIX operating systems

• Usually the only editor available in emergencies

• Relatively hard to learn, but really powerful

• As a Linux user, you should be able to use vi for basic editing tasks

-But it's OK if you prefer another editor for daily work

• vi in Linux is usually vim (vi improved):

• Syntax highlighting

• Arrow keys, Del, BS work in insert mode

• Multi level undo

• Mouse support

N P

F

L

Page 120: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Edit text files with vi

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

N P

F

L

Page 121: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Edit text files with vi

$ vi myfile.txt

Cursor Movement in Command Mode

_________________________________

N P

F

L

Page 122: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Edit text files with vi

Editing Text in Command Mode

____________________________

To delete a single character under cursor x

To delete a single character left of cursor X

To replace a single character r

Undo the last change u

To repeat last command .

To join two lines together J

N P

F

L

Page 123: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Edit text files with vi

Switching to Edit Mode

____________________ • To insert text at begin of line I

• To insert text before cursor i

• To append text after cursor a

• To append text at end of line A

• To go back to command mode <ESC>

N P

F

L

Page 124: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Edit text files with vi

Searching for mhany

___________________ To search for a pattern (in command mode): /<mhany>

Replacing Patterns

_________________ Advanced search and replace can be done in ex mode:

To replace old with new: :1,$s /old/new/g

N P

F

L

Page 125: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Edit text files with vi

Cut, Copy and Paste

___________________ • To cut a whole line into buffer: dd

• To copy a whole line into buffer: yy

• To paste contents of buffers here: p

• To cut, copy multiple lines, proceed command by number: 3dd, 8yy

Exiting vi__ • To save and exit in command mode ZZ

• To save in ex mode :w

• To forcefully save file in ex mode :w!

• To quit without saving in ex mode :q

• To forcefully exit in ex mode :q!

• To save and exit in ex mode (recommended) :wq

• To save and exit in ex mode, shorter :x

N P

F

L

Page 126: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Edit text files with vi N P

F

L

Page 127: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

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

N P

F

L

Page 128: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 129: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Page 130: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Unit9:

Shell Basics

N P

F

L

Page 131: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Module Overview

o Explain the function of the shell

o Discuss metacharacters and reserved words

o Use wildcards to access files with similar names

o Use redirection and pipes

o Use command substitution

o Work with shell variables

o Use aliases

o Create Scripts

N P

F

L

Page 132: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Explain the function of the shell

The Shell

The "shell" is the user interface to Linux

N P

F

L

Page 133: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Discuss metacharacters and

reserved words

Metacharacters and Reserved Words

Metacharacters are characters that the shell interprets as having a

special meaning.

Reserved words are words that the shell interprets as special

commands.

Examples:

< > | ; ! ? * [ ] $ \ " ' ` ~ ( ) { }

Examples:

case do done elif else esac fi for function if in select then

until while

N P

F

L

Page 134: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Use wildcards to access files

with similar names

$ echo *[1-5] get all file that have no – 1 to 5

test1 test2

$ echo [!t]* get all files exception have (t)

Myfile

$ echo ?[!y]*[2-5] non have (y) but have 2 to 5

test2 test1

N P

F

L

Page 135: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Use redirection and pipes

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

N P

F

L

Page 136: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Input Redirection

STDIN redirected from file:

$ cat < file1

Hi

Welcome

Etc

Use redirection and pipes N P

F

L

Page 137: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Use redirection and pipes

Output Redirection

$ ls > fileb

$ cat > new_filex

Save this line

<Ctrl-D>

N P

F

L

Page 138: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Use redirection and pipes

Error Redirection

$ ls-l 2> errorfile

$ cat errorfile

Ls-l command not found

----------------------------------------------------------------

Redirect and append errors to a file:

$ cat-a 2>> errorfile

N P

F

L

Page 139: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Use redirection and pipes

Pipes A sequence of two or more commands separated by a

vertical bar (|) is called a pipe or pipeline

$ ls –l | wc -l

N P

F

L

Page 140: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

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

Use redirection and pipes N P

F

L

Page 141: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Use redirection and pipes

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

N P

F

L

Page 142: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Use command substitution

Command Substitution Command Substitution allows you to use the output of a command

as arguments for another command.

$ echo there are $(cat filea | wc –l)

N P

F

L

Page 143: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Use command substitution

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

N P

F

L

Page 144: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Work with shell variables

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

N P

F

L

Page 145: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Work with shell variables

$ x=6

$ echo „my number is $x‟

My number is $x

$ echo “my number is $x”

My number is 6

N P

F

L

Page 146: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Work with shell variables

Standard Shell Variables The shell uses several shell variables internally

These variables are always written in uppercase

Example:

$: PID of current shell

PATH: Path which is searched for executable’s

PS1: Primary shell prompt

PS2: Secondary shell prompt

PWD: Current working directory

HOME: Home directory of user

LANG: Language of user

N P

F

L

Page 147: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Work with shell variables

Return Codes from Commands A command returns a value to the parent process. By convention, zero means

success and a non-zero value means an error occurred.

A pipeline returns a single value to its parent

The environment variable ? contains the return code of the previous command.

$ ls

Fiel1 file2 dir1 dir2

$ echo $?

0

$ cat fileab

cat: filea: No such file or directory

$ echo $?

1

N P

F

L

Page 148: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Use aliases

Aliases The alias command allows you to set up aliases for often-used commands

Examples:

$ alias ll='ls -l'

$ alias rm='rm -i'

To show all currently defined aliases:

$ alias

To delete an alias: $ unalias ll

$ ll

bash: ll: command not found

N P

F

L

Page 149: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Create Scripts

$ vi momenscript

>ls

>date

:wq

---------------------------------------------------------------------------------

$ chmod 700 momenscript

$ ls –l

momenscript

$ bash momenscript

$ source momenscript

$ sh momenscript

$ . momenscript

N P

F

L

Page 150: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 151: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Page 152: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Unit10:

Working with Processes

N P

F

L

Page 153: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Module Overview

o Define a Linux process

o Describe the relationship between parent and child processes

o Explain the purpose of a shell

o Start foreground and background processes

o Explain the concept of signals and use them to terminate

processes

o Manage processes using GUI

N P

F

L

Page 154: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Define a Linux process

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:

To see the PID of your current shell process type:

$ echo $$

N P

F

L

Page 155: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the relationship between

parent and child processes

All processes are started by other processes

Parent/Child relationship

$ ls -l

A process can be terminated because of two reasons:

• The process terminates itself when done

• The process is terminated by a signal from another process

N P

F

L

Page 156: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the relationship between

parent and child processes

Monitoring Processes

The ps command displays process status information

ps supports a large number of options - you typically use ps aux:

• a all processes attached to a terminal

• x all other processes

• u provides more columns

N P

F

L

Page 157: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Describe the relationship between

parent and child processes

Viewing Process Hierarchy

pstree shows process hierarchy

Or

$ top

N P

F

L

Page 158: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Start foreground and

background processes

Starting Processes

Foreground Processes

Background Processes

N P

F

L

Page 159: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Start foreground and

background processes

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.

N P

F

L

Page 160: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Explain the concept of signals and use

them to terminate processes

Job Control in the Bash Shell

<ctrl-z> suspends foreground task

jobs lists background or suspended jobs

fg resume suspended task in the foreground

bg resume suspended task in the background

N P

F

L

Page 161: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Explain the concept of signals and use

them to terminate processes

Kill Signals

Several signals can be sent to a process

Using keyboard interrupts (if foreground process) $ kill -9 5698

Using the kill command

Synopsis: kill -signal PID

Using the killall command to kill all named apps

Synopsis: killall -signal application

N P

F

L

Page 162: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Explain the concept of signals and use

them to terminate processes

Running Long Processes

The nohup command stops a process from being killed if you

log off the system before it completes, by intercepting and

ignoring the SIGHUP and SIGQUIT (hangup and quit) signals.

$ nohup ls –l Run command

$ logout Logout from system

Login login to system

$ cat nohup.out if you need to show last run command result

N P

F

L

Page 163: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Explain the concept of signals and use

them to terminate processes N P

F

L

Page 164: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Explain the concept of signals and use

them to terminate processes

The nice Command

The nice command is used to start a process with a user

defined priority

nice [-n <value>] <original command>

$ nice –n 11 ls –l Run (ls –l)command with priority <11>

N P

F

L

Page 165: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Explain the concept of signals and use

them to terminate processes

The renice Command

The renice command is used to change the priority of a

currently running process

renice <new_priority> <PID>

$ renice 7 6593 Change pritority value 4 PID 6593 to <7>

N P

F

L

Page 166: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Manage processes using

GUI N P

F

L

Page 167: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 168: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Page 169: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Unit11:

Linux Utilities

N P

F

L

Page 170: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Module Overview

o Use the find and locate command to search for files

o Use the cut command to list specific columns of a file

o Use the grep command to search text files for patterns

o Use the head and tail commands to view specific lines in a file

o Use the sort command to sort the contents of a file

o Use the type, which and whereis commands to find commands

o Use the file command to find out the content of a file

o Use the join commands to combine files

o Comprise the files

N P

F

L

Page 171: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

The find Command

$ find path expression

N P

F

L

Page 172: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

The find Command

$ find . -name phone Search about phone in current directory

$ find . -name phone –print Search and print path

$ find . -name 'b*' -exec ls -i {} \; search any file have (B) and execute as ls -l

$ find . -name b\* -ok rm {} \; search any file have (B) and remove file by file

$ find . -name b\* -exec rm {} \; search any file have (B) and remove all file

$ find . -perm 764 Search by permision 764

$ find . -name 's*' -type f -a -size +2\ Search by size +2 k

locate Command locate allows you to quickly find a file on the system, based on

simple criteria

$ updatedb

$ locate README

N P

F

L

Page 173: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

The Cut Command

The cut Command Pull selected columns or fields from one or more files.

Syntax:

cut -f(ields) -d(elimiter) file(s)

cut -c(haracters) file(s)

$ cut –f 1,3,4,7,9 –d: /etc/passwd

$ cut –f 1-18 –d /etc/passwd > outputfile

$ cat outputfile

N P

F

L

Page 174: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

The grep Command

The grep Command Searches one or more files or standard input for lines matching pattern

Simple match or Regular Expression

Syntax

grep [options] pattern [file1 ...]

$ grep root /etc/passwd get number of (root) word in etc/passwd file

Option‟s:

-c “root$” get but root must existing in last line

-c “root^” get but root must existing in first line

N P

F

L

Page 175: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

The grep Command

The grep Command

$ fgrep Faster can‟t use Metacharacters (* \ / -)

$ egrep search about more than word‟s in file such as < $

grep „test1 ; phone „

$ zgrep Search in Compressed file (file.tar.gz or file.bz2)

Note:-

You can search about paragraph in file by „paragraph‟

N P

F

L

Page 176: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

The head and tail Commands The head command can be used to view the first few lines of a file

or files. The command syntax is:

$ head [-lines] file(s)

$ head -4 /etc/passwd Show only first 4 lines in passwd file

---------------------------------------------------------------------------

The tail command displays the last few lines of a file or files. The

command syntax is:

$ tail [{-lines|+lines|}] file(s)

$ tail -4 /etc/passwd Show only last 4 lines in passwd file

$ tail -4 | head -4

The head and tail Command

Page 177: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

The Sort Command

The Sort Command The sort command sorts the lines in the file specified and writes the result to

standard output.

$ sort /etc/passwd Sort file from A-Z

$ sort –n /etc/passwd Sort file by number from 1-9

$ sort –r /etc/passwd Sort file by reverse viewer

Page 178: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

The type, which and whereis commands

The type, which and whereis Commands

To find out what the path to a command is, use type

$ type ls date echo ---------------------------------------------------------------------------------------------

To find out where the binary is located, use which

$ which ls date echo ---------------------------------------------------------------------------------------------

To locate the binary, source and manual page files of a command, use whereis

$ whereis ls date echo

Page 179: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

The file Command

The file Command With the file command, you can find out what the type of data in the file is.

$ file /etc/passwd

$ file /lib/cpp

Page 180: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

The join command

The Join Command The join and paste commands allow you to merge files together.

(1)

$ vi one

A xxx

B xxx

C xxx

:wq

(2)

$ vi two

A yyy

B yyy

C yyy

:wq

Page 181: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

The join commands

(3)

$ join one two

A xxx yyy

B xxx yyy

C xxx yyy

--------------------------------------------------------------------------------------

Output this value

$ join one two > mergedfile

Page 182: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Compress The File

The gzip, gunzip and zcat Commands

To compress or uncompress files use gzip, gunzip or zcat

$ gzip fileneme Compress File

$ gunzip filename Un Compress file

$ zcat file.gz Show compressed file

$ zgrep file.gz

$ zless file.gz

$ zmore file.gz

Page 183: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 184: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Page 185: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Unit12:

Shell Scripts

N P

F

L

Page 186: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Module Overview

o Create a Scripts

N P

F

L

Page 187: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Create Scripts

$ vi momenscript

>ls

>date

:wq

---------------------------------------------------------------------------------

$ chmod 700 momenscript

$ ls –l

momenscript

$ bash momenscript

$ source momenscript

$ sh momenscript

$ . momenscript

N P

F

L

Page 188: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 189: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Page 190: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Unit13:

Linux GUI

N P

F

L

Page 191: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Module Overview

o Components of the X Window System

o The function of the X Server

o The main characteristics of Desktop Environments

o Switch between GNOME and KDE

N P

F

L

Page 192: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

The Linux Graphical User Interface • The "X Window System" is the GUI of Linux

• Developed at MIT in 1984

• Current standards body: X Consortium Shortname: X ( XI Graphic &

Xfree Graphic)

X uses client-server model with network connections

• Highly flexible

• Easy exchange of components

• Supports networked applications and sessions, independent of

• the OS

Components of the X Window System

Page 193: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

The function of the X Server

Page 194: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

X Components

An X Server • Controls keyboard, mouse and one or more screens

• Controls resolution, refresh rate and color depth

• Allows simultaneous access by several clients

• Performs basic graphic operations

• Forwards keyboard and mouse events to the correct clients

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

Components of the X Window System

Page 195: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

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

X

Page 196: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

X Servers in Linux

Most distributions use XFree86 (www.xfree86.org) as their X Server • Open Source

• Supports most video adapters

Other X Servers for Linux are available as well • Metro-X (http://www.metrolink.com)

• Xi Graphics (http://www.xig.com)

X

Page 197: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Desktop Environments

Examples:

• GNOME (GNU Network Object Model Environment)

• KDE (K Desktop Environment)

The main characteristics of

Desktop Environments

Page 198: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Switch between GNOME and KDE

Page 199: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 200: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

RH033 - Red Hat Linux Essentials

RHCE

N P

F

L

Page 201: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Unit14:

Basic System Configuration Tool

N P

F

L

Page 202: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Module Overview

o List the order of login scripts

o Discuss System Management tools

o Install and uninstall additional software

o Configure a printer

o Configure a Network and sound card

N P

F

L

Page 203: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

List the order of login scripts

Customizing User Environment

Bash Initialization

/etc/profile Contain system administrator processes

$ HOME/.bash_profile Contain User processes

$ HOME/.bash_login Contain Login User Configuration

$ HOME/.profile

$ HOME/.bash_logout Contain Logout User Configuration

$ HOME/.bash_history Save all Command history.

$ HOME/.bashrc Contain Alias Command

# cat .bash_history

Page 204: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Discuss System Management tools

List setup command (TUI Tool)

# setup

List system-config-<tab> command (GUI Tool)

# system-config-<press tab>

GUI System \ Administration

Page 205: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Install and uninstall additional software

Adding/Removing Software Using RPM

Use rpm to install or upgrade software packages

Common options:

-i : installing new packages

-U : upgrading existing packages

-e : removing packages

-h : Shows a progress bar

$ rpm -ihv momenpro.i386.rpm

momenpro ###############....

$ rpm -Uhv momenpro.i386.rpm

momenpro ###############.....

$ rpm -e momenpro

RPM

Red hat Package Management

Page 206: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Install and uninstall additional software

You can Donwload any RPM pachage using Linux Tools such as , wget :

# wget <download link>

#wget http://www.download.org/rpmpackages/webmin.rpm

30% Webmin.rpm ###############.... 70kbp/s Total Size 16MB

Use rpm Command

# rpm –i packagename

# rpm –ivh packagename install package with show information and progress

# rpm –Uvh Packagename upgradeing with show info and progress

# rpm –q packagename Quarry about packagename

Page 207: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Install and uninstall additional software

Install tar package and compressed file:

# tar –zxf packagename.tar.gz

( z ) for gzip

( x ) for tar package extension

( f ) for file

Page 208: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

X

Install and access webmin

To access webmin interface

http://localhost.localdomain:10000

Page 209: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Configure a printer

To access Printer Manager Console

http://localhost:631

Add New Printer ?

Add New Class ?

Manage Permission ?

….

Page 210: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Configure a Network and

Sound card

Configure Network Card :

# ifconfig for show ethernet configuration in tur

# neat for show ethernet configuration in GUI

# ifconfig eth0 select and edite in eth0

# system-config-network -()()()()()()-

Page 211: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Configure a Network and

Sound card

Configure Sound card :

# system-config-soundcard

-GUI System\ Administration \Sound card detection

Page 212: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 213: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

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 Linux-

related 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.

Page 214: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

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).

Page 215: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Certification Information

N P

F

L

The LX02 (Linux Power User) is the entry course in the IBM/Linux curriculum. Its

aim is to teach a Linux novice to install and configure Linux so that he/she is able to

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.

Page 216: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Certification Information

N P

F

L

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.

Page 217: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

Certification Information

N P

F

L

Page 218: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Copyright © March 2012 , Engineer Mo‟men Hany Mohamed

Page 219: 0-Rhce Essential Book by Eng Mo'Men Hany

By Eng Mo‟men Hany © Mobil: 01143739545 ^ Email: [email protected]

N P

F

L

Page 220: 0-Rhce Essential Book by Eng Mo'Men Hany

White Board

Last Viewed

Copyright © March 2012 ,

Engineer Mo‟men Hany Mohamed