Documente Academic
Documente Profesional
Documente Cultură
RHCE ~
F
N P
L
Welcome in
F
Contents 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 RH033 - Red Hat Linux Essentials
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
F
N P
L
Unit1:
History For UNIX & LINUX
o What is O.S ?
o What is Kernel ?
o UNIX History ?
o LINUX History ?
o Linux Distributions .
Hardwar O.S
http://www.kernel.org/
Best Company in the world introduced Linux Red Hat and Fedora O.S Dist.
http://www.redhat.com/about/company/history.html
http://distrowatch.com/
F
N P
L
Unit2:
Linux Enveronment
o File Structure .
o Shell Prompt .
root home usr dev mnt etc var boot bin sbin opt
Admin System Other Variable User Third
Home Executable Mount Files Executable Party App
Directory Files Devices Files
Partition Leased
SWAP Partition
Go To Lab
Note:-
A typical Linux system will run six virtual
consoles and one graphical console
F
N P
L
Unit3:
Using The System
Command Prompt
Examples:
[user@host ~]$
[root@host ~]#
$
#
The dollar ($) usually means: "logged in as regular user"
The hash (#) usually means: "logged in as root"
$ 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
RIGHT WRONG
1. Separation 1. Separation
$ mail -f personal $ mail - f personal
$ who -u $ who-u
2. Order 2. Order
$ mail -s test root $ mail test root -s
$ who -u $ -u who
3. Multiple options 3. Multiple options
$ who -m -u $ who -m-u
$ who mu $ who -m u
$ date
Fri Jun 6 11:15:10 CET 2003
June 2003
Su Mo Tu We Th Fr Sa
1234567
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30
$
$ mesg y
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
Go To Lab
F
N P
L
Unit4:
Working with Files and Directories
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
$ mkdir -p dir1/dir2/dir3
$ rmdir -p dir1/dir2/dir3
cp source[s] [target]
$ cp r dir1 /home/user1/myfiles
$ cp r .dir1 /home/user1/myfiles/momendir Copy Hidden Dir with new name
$ mv file1 /home/user1
$ mv file1 dir1 /home/user1 Move multi files and Dir
$ mv dir11 /home/user1/dir12 Move Dir with new name
_____________________________________________________
Hide File or Directorys
____________________
$ mv file1 .file1
$ mv dir4 .dir4
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)
$ cat File2
--------------------------------------------------------------------------------
File Details
_________
$ less File1
$ more File1
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>
Or
F
N P
L
Unit5:
File and Directory Permissions
Access Level
Permission
$ 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
Assign Permission
R 22 =4
User group other W 21 =2
rwx rwx rwx X 20 =1
- 0 =0
421 421 42 1 ---------------------
------ ------- ------- 7
7 7 7 =Full Control 4 (U+G+O)
Example:-
Example:-
I need when create any new Directory the default permission is { rw- r r--} (644)
? UMASK is 133
$ umask 133
Note:
If Machine Restarted the umask change to default (022,002)
umask 022
F
N P
L
Unit6:
Linux Documentation & Help
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,: :
$ man k print
$ 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
$ whatis pwd
Usually stored in
/usr/share/doc/<programname>
F
N P
L
Unit7:
Tour Through Linux
/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).
/dev
____
Contains special files that represent hardware devices
Block special device, for example, a hard disk
Character special device, for example, mouse and
keyboard
/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
/home
_____
/mnt
____
/proc
_____
Virtual filesystem
Represents kernel and process information
/root
____
Home directory of the root user
/tmp
____
/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
/var
____
Files of variable size
Logfiles
Lockfiles
Directories with variable content
Mail
Scheduling
Printing
Temporary storage space, longer than /tmp
/lost+found
__________
Exists in every filesystem
Place where lost+found files are stored after a crash recovery by fsck.
Other Directories in /
____________________
$ umount /dev/hda5
- OR -
$ umount /usr
F
N P
L
Unit8:
Editing Files
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
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
$ vi myfile.txt
Replacing Patterns
_________________
Advanced search and replace can be done in ex mode:
To replace old with new: :1,$s /old/new/g
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
F
N P
L
Unit9:
Shell Basics
The Shell
The "shell" is the user interface to Linux
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
Input Redirection
Output Redirection
$ ls > fileb
Error Redirection
$ cat errorfile
Ls-l command not found
----------------------------------------------------------------
Redirect and append errors to a file:
Pipes
A sequence of two or more commands separated by a
vertical bar (|) is called a pipe or pipeline
$ ls l | wc -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
$ ls | tee ls1.save | wc -l
3
$ cat ls1.save
file1
file2
file3
Command Substitution
Command Substitution allows you to use the output of a command
as arguments for another command.
Command Grouping
Multiple commands can be entered on the same line,
separated by a semicolon (;)
$ date ; pwd
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
$ x=6
$ echo my number is $x
My number is $x
$ echo my number is $x
My number is 6
Aliases
The alias command allows you to set up aliases for often-used commands
Examples:
$ ls l
momenscript
$ bash momenscript
$ source momenscript
$ sh momenscript
$ . momenscript
F
N P
L
Unit10:
Working with Processes
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:
Or
$ top
Foreground Background
Processes 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
F
N P
L
Unit11:
Linux Utilities
locate Command
locate allows you to quickly find a file on the system, based on
simple criteria
$ updatedb
$ locate README
Options:
Note:-
You can search about paragraph in file by paragraph
$ tail -4 | head -4
$ file /etc/passwd
$ file /lib/cpp
(1)
$ vi one
A xxx
B xxx
C xxx
:wq
(2)
$ vi two
A yyy
B yyy
C yyy
:wq
$ zgrep file.gz
$ zless file.gz
$ zmore file.gz
F
N P
L
Unit12:
Shell Scripts
o Create a Scripts
$ ls l
momenscript
$ bash momenscript
$ source momenscript
$ sh momenscript
$ . momenscript
F
N P
L
Unit13:
Linux GUI
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 Servers in Linux
Desktop Environments
Examples:
GNOME (GNU Network Object Model Environment)
KDE (K Desktop Environment)
F
N P
L
Unit14:
Basic System Configuration Tool
o Configure a printer
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
# setup
# system-config-<press tab>
# 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
http://localhost:631
# system-config-soundcard
Last Viewed
Copyright March 2012 ,
Engineer Momen Hany Mohamed