RH033
RH033
RH033
ABI/API Compatibility
Everything is a file.
Including hardware
http://www.gnu.org/philosophy/free-sw.ht
ml
6
http://www.gnu.org/copyleft/gpl.html
X Window System, has its own T&C.
BSD code need to be abide the terms of
Berkeley Software Distribution. Visit
http://www.bsd.com
Linux Torvalds
Finish College Student in 1991
Created Linux Kernel
A distribution of Linux
10
Or
11
12
Or
http://www.x.org/wiki
X Client activity that spawns an X server event informing the
web browser to send an HTTP request to the links target ( or
anchor). You do not really see the X server, but X clients.
X provides the data I/O infrastructure for X clients, like a human
nervous system, it sends messages when touched by client
activity.
An X Client running on one system can display on any X server
running on any operating system, if sufficient access is granted.
For each managed display, this socket is /tmp/.X11-unix/X#
where # is 0 to the greatest number of permitted connections.
13
14
Changing Password.
At least 6 but no more that 255 characters.
Other criteria depends on particular OS.
15
16
--help
whatis -- with makewhatis
man
info
/usr/share/doc/html/en/
Software source code
Documentations
17
18
19
Manual Sections.
1
2
3
4
5
6
7
8
User Commands
System Calls
Library Calls
Special Files
File Formats
Games
Miscellaneous
Administrative Commands
20
info [<command>]
If you run info with no arguments you will
be presented with a list links to the top
nodes of every available info page.
21
node
s[<text>]
22
/usr/share/doc
http://www.redhat.com/docs
23
24
25
26
/etc
-System Configuration Files
/tmp -Temporary files
/boot -Kernel and boot loader
/var and /svr
-Server data
/proc and /sys
-system Information
The lib directories
28
29
30
$ cd
33
rm remove files
Usage:
rm [options] filenames
-i interactive
-r recursive
-f force
35
Desktop icons
Home:
Computer:
36
Context Menu
37
38
Syntax:
cat [options] [files..]
Contents of the files are displayed
sequentially with no break.
Files display concatenated.
-A
Show all characters, including
control characters and non-printing
characters.
-s
Squeeze multiple adjacent blank
lines into a single blank line.
-bNumber each (non-blank) line of
output.
39
Syntax:
40
<space>
<return>
<Ctrl-d>
g
/text
n
q
b
k
<Ctrl-u>
G
?text
N
v
41
-c
42
43
44
45
46
Tilde(~)
47
Parameter/Variable: ($)
strings.
48
Command Output or $ ()
Arithmetic - $[]
Substitute result of arithmetic expression in a
command line.
$echo Area : $[$X * $Y]
$echo Area : `expr $X\*$Y`
49
50
{reverse-i-search)`:
<ESC>, (the escape key followed by a period)
<ALT -.> (hold down the alt key while pressing the
period)
52
moves to beginning of
line.
<Ctrl-e>
moves to the end of line.
<Ctrl-u>
deletes to beginning of
line
<Ctrl-k>
deletes to end of line.
<Ctrl-arrow>
moves left or right by
word.
* Inherited from emacs.
<Ctrl-a>
53
54
Applications/System Tools/Terminal
Graphical terminal emulator with support
for maintaining multiple tabbed shells
simultaneously.
<Ctrl-Shift-t>
Open a new tab
<Ctrl-PgUp/PgDn> Next/Prev tab
<Ctrl-Shift-c/v> Copy/Paste
55
56
57
Redirecting
> command > file Directs standard output of command to file
>>
command > file Appends standard output of command to
file.
< command < file command receives its input from file.
2> command 2>file Error messages from command are directed to file.
2>>
command 2>>file
Error messages from command
are appended to file.
Piping
|
command1 | command 2
command1 into the
command2.
59
61
62
63
$ ls /usr/lib | less
64
And
65
ls l | less
ls l | mail s Files [email protected]
ls l | lpr
cat files_to_delete.txt | xargs rm f
tee
66
67
68
69
71
72
listing
73
u,g or o (a)
+ or (=)
r,w or x
Examples:
ugo+r
o-wx
75
(for read)
(for write)
(for execute)
Example:
76
77
ed ex vi vim
78
79
vi -m myfile
vi R myfile
the
vi n myfile
backup
vi r myfile
after a
vi x myfile
decrypt when
file is non-modifiable
file is only modifiable by using
exclamation point :w!
do not use a swap file for
(useful for floppies)
recover data from a swap file
crash
encrypt file when saving,
editing
80
Command Mode
Cursor movement
Change, delete, yank, put, search
Insert mode
Type in new text
Return to command mode with <ESC>
ex mode
Configuring, exiting, saving
Search and replace
81
h left
j down
k up
l right
w word ahead
b word back
( Sentence Back
) Sentence forward
{ Paragraph above
} Paragraph below
Arrow keys (, , etc) also work.
A word is defined as a series of letters of the alphabet and
numbers uninterrupted by white space or punctuation.
If the cursor is on a punctuation character, the word is
terminated by white space or a letter of the alphabet or number.
82
a
i
o
A
append to end of line.
I
insert at beginning of line.
O
Open a line above.
Pattern such as these permeate the vi
and vim commands.
83
84
Yank(Copy)
Line
Letter
yl
Word
Sentence ahead
Sentence behind
Paragraph ahead
Paragraph behind
Change
cc
Delete
dd
cl
cw
c)
c(
c{
c}
yy
dl
dw
d)
d(
d{
d}
yw
y)
y(
y{
y}
86
u
U
87
/text
?text
n
88
dtc
delete from cursor to the
letter c
(does not span
lines)
5dd
delete five lines( a number can
precede any of the two
character
change, delete,
yank or put
commands).
x
delete a character
rc
replace a character with c
r
replace character-for-character
until
<Esc>
89
Exit
Do not exit
save changes
:wq
:w
Abandon changes
:q or :q!
:e!
Forcing Changes:
Save changes
Exit
:wq!
Do not Exit
:w!
Abandon changes, staying in the editor, through :e! and force
a write through :w!. Finally, force a write through :w1!.
Finally, force a write and quit with :wq!. The last command
will forcibly write the file, but only quit if the forcible write
was successful.
90
lpr
lpq
View the contens of the
queue.
lprm Remove a job from the queue.
System V printing commands such as lp,
lpstat and cancel are also supported.
A user may only remove his own print
jobs from the queue.
92
enscript
Converts text to PostScript
a2ps
Converts text to PostScript
ggv(GNOME GhostView) PostScript and PDF
Viewer
xpdf
PDF viewer.
ps2pdf
PostScript to PDF converter.
pdf2ps
PDF to PostScript converter.
mpage
Prints multiple pages per sheet.
93
94
95
96
The cp command:
Allocates a free inode number, placing a new
entry in the inode table.
Creates a directory entry, referencing the files
human file name to the inode number.
Copies data into the new file.
99
100
The rm command:
Decrements the link count, thus freeing the
inode number to be reused.
Places data block on the free list.
Removes the directory entry.
101
Syntax:
102
103
ln filename [linkname]
104
105
d
l
b
c
p
s
regular files
directory
symbolic link
block special file
character special file
named pipe
socket
106
Files referencing hardware are not regular files; they are one of the
two types of special files. Character special files are used to
communicate with hardware one character at a time.
p named pipe:
A file that passes data between processes. It stores no data itself, but
passes between one process writing data into the named pipe and
another process reading data from the named pipe. A named pipe can
be created using the mknod command:
mknod mypipe p
socket:
107
df
du
mount
umount
eject
mtools(mdir,mcopy)
108
109
110
$FAV_COLOR=blue
$echo $FAV_COLOR
$blue
HISTFILESIZE
Determines how many commands to be saved in the
history file on logout.
COLUMNS
Sets the width of the terminal( xterm, gonme-terminal
or kterm)
LINES
Sets the height of the terminal ( xterm, gonme-terminal
or kterm)
HISTFILE
Specifies the file in which history commands are stored
on logout
HISTSIZE
Specifies the number of history commands to keep
while operating interactively.
113
\d
\h
\t
\u
114
115
set
shopt
set b
report termination of
background commands
immediately, rather than
waiting for next prompt.
set u
unset variables generate an
error.
set o noclobber
do not clobber with > and
>& operators.
set o vi
use vi syntax on bash command
line instead of default emacs
syntax.
For a complete list of set values, see the set command under the SHELL
BUILTIN COMMANDS section of the bash man page. Also in this section is
a list of items configurable through the shopt command.
116
HOME
LANG
should
English.
PWD
EDITOR
LESS
SHELL
USER
DISPLAY
VISUAL
118
119
PATH
colon separated list of locations where
commands
can be found.
When a command is executed and the path is not
specified, then the shell will look in these directories in
the given order, stopping on first match, to find the
command.
which
command showing location in the PATH of an
executable
Executables
$which xterm
$ /usr/bin/xterm
$/bin/ls /etc
./myls /etc
Use the built-in shell type command to ask the shell what
is using to fulfill the following commands.
120
A simplification:
Split the line into words
Function and alias expansion
Curly brace string expansion
Tilde expansion
Parameter and variable expansion
Split the line into words again
File glob expansion
File redirection
Run the command!
121
122
123
Login Shells
/etc/profile
/etc/profile.d
~/.bash_profile
~/.bashrc
/etc/bashrc
Non-login Shells
~/.bashrc
/etc/bashrc
/etc/profile.d
124
126
128
/dev/sdaX
mount /media/floppy
umount /media/floppy
mdir a:
mcopy /home/file.txt a:
130
A filesystem, one of :
131
132
Syntax:
tar cvf archive_name files
c
creates a new archive.
v
produces verbose messages.
F
archive_name is the name of the new
file.
133
Syntax:
tar tf archive_name.tar
tar tvfarchive_name.tar
134
Syntax
archive_name.tar
tar xvf
135
136
gzip, gunzip
bzip2, bunzip2
137
138
139
Example:
140
141
/etc/passwd
/etc/shadow
/etc/group
/etc/gshadow
143
144
145
groups, id
whoami
users, who, w
Login/reboot history
last
146
147
148
149
150
152
153
$head /tmp/output.txt
$head n 20 /tmp/output.txt
154
$tail n 5 /etc/passwd
$tail /etc/passwd
$tail f make.out
$wc story.txt
156
Common options
157
158
159
$cut f3 d: /etc/passwd
-c cuts by characters
$cut c2-5 /user/share/dict/words
160
162
Interactive spell-checker
Easy way to check spelling in a file.
$look must
163
pr
164
Advanced!
More advanced.
Simple
165
166
G
1G
167
H
go to first line on
screen(high)
M
go to middle line on screen
(middle)
L
go to last line on screen(low)
z<Enter> Make current line first line on
screen.
zmake current line last line on
screen.
168
!!date
Replace current line with the output of date command.
!}sort
The paragraph will then be replaced with the output of the
sort command.
!}fmt -66
Will replace the paragraph with a paragraph formatted to
169
+10)
Example: :%s/Ohiho/Iowa/g
:%s/dev/had /dev/sdag
:%s/\/dev\/had/\/dev/\sda/g
170
v
character-oriented highlighting
V
line-orienting highlighting
<Ctrl-v> block orienting highlighting
Visual Keys can be used in conjunction with movement
keys: w, ), }, arrows, etc.
Highlighted text can be deleted, yanked, changed,
filtered, search/replaced, etc.
c change
d
delete y
yank(copy)
171
:r
newfile
:r
!date
:1,20w xfile
:.,$w yfile
:1,20w >>zfile
:n
otherfile
:n!
otherfile
:n#
172
Configure permanetly
:set
:set
:set
:set
173
174
176
Two types:
Basic
Extended
177
grep
: the general regular expression
processor, which analyzes the contents of files a
line at a time, returning line that match a
pattern.
Sed
: the stream editor, returns the contents
of a file (or stream of data), performing a
specified search and replace instruction.
less
: which uses regular expression in search
commands.
vi : which uses regular expression for searches
(like less) or search and replace (like sed).
awk
: a data oriented programming language.
178
179
-v
return lines that do not contain
pattern
-n precede returned lines with line
numbers.
-c only return a count of line with the
matching pattern.
-l only return the names of the files that
have at least one line containing the
pattern.
-r
perform a recursive search of files,
starting with the named directory.
-i perform a case-sensitive search.
180
182
183
184
Search for files owned by the user gmustafa and the group
gmustafa
The regex option in find does not work quite the way one
would expect. regex applies the regular expression to the
name of the file, including the absolute path to the file.
185
$
$
$
$
$
find
find
find
find
find
186
$ find / -atime 5
The date of the last time the file was read (-atime)
$ find / -mtime +5
The date of the last change to the files data (-mtime)
$ find / -ctime -5
The date of the last changes to the files metadata. (-ctime)
188
189
190
recent_file.txt.
191
192
193
194
195
196
-R
-S
Sleeping
-T
stopped
-D
Uninterruptible sleep
Process is sleeping and can not be woken up until an even occurs. It can be
-Z
Just before a process dies, it sends a signal to its parent and waits for an
197
ps
Displays processes information
Syntax:
ps [options]
Useful options:
a
x
u
w
f
198
Syntax:
$killall
Read man 7 signal.
kill can send many signals, but processes only respond to
the signals they have been programmed to recognize.
Signals may be sent to processes interactively using top
and gnome-system-monitor.
199
200
201
202
$ nice myprog
$ nice n 15 myprog
203
$ renice 15 u gmustafa
204
205
207
208
Syntax:
$ at time
<commands>
$ atq
[user]
$ atrm [user|atJobID]
$
$
$
$
at
at
at
at
8:00pm December 7
7 am Thursday
now + 5 minutes
midnight +23 minutes
210
211
Syntax
$ crontab [-u user] file
$ crontab [-l | -r | -e]
212
213
Network Clients
214
Epiphany
Uses same rendering engine as Firefox
Fully Gnome-complaint, but fewer features.
Konqueror
KDE web browser/file manager
Supports tabs, popup-blocking, etc.
Uses khtml rendering engine.
215
links
Provided by the elinks rpm
Full support from frames and ssl
Examples
$ links http://www.redhat.com
$ links dump http://www.redhat.com
$ links source http://www.redhat.com
216
217
ssh/scp
telnet and the r services
rsync
FTP clients
Nautilus
218
219
$ telnet localhost 25
221
222
223
Applications/Internet/gFTP
Graphical FTP Client
Allows Drag-and-Drop transfers
Anonymous or Authenticated access
Optional secure transfer via ssh (sftp).
224
Access a share
$smbclient U student //server1/homes
-w
workgroup or domain
-U
Username
-N
Suppress password prompt (otherwise you will
be asked for a password).
225
ping
tracroute
netstat
dig
host
Displays the computers through which a packet must pass to reach another
system.
mrt
gnome-nettool (GUI)
A graphical front end of tools listed above (as well as some others) in a single,
simple interface. gnome-nettool can be run from the command line or by
selecting its icon from the internet section of the Application Menu. Note that,
this tool may no be installed by default.
226
227
228
229
Step 2:
230
231
232
#!/bin/bash
echo n Enter name (First Last):
read FIRST LAST
printf Your First name is %s and your last name is %s \n \
$FIRST $LAST
The (-p) option is used to display a prompt string. Place quotes
around the string if you need to prompt the user with a multipleword command
#!/bin/bash
read p Enter Several Values: value1 value2 value3
echo value 1 is $value1
echo value 2 is $value2
echo value 3 is $value3
233
234
235
&&
||
logical AND
logical OR
Examples:
$ grep gmustafa passwd || echo No
gmustafa!
$ cp a /tmp/*.o . && echo Done!
236
if [condition]; then
do something
fi
237
File tests:
tests to see if file exist and is a
regular file
-d
tests to see if a file exists and is a
directory
-x
tests to see if a file exits and is
executable
if [-f $HOME/lib/functions ]; then
-f
source ~/lib/functions
fi
238
-d FILE
True if file is a directory
-e FILE
True if file exists.
-f FILE
True if file exits and is a regular file
-h FILE
True if file is a symbolic link.
-L FILE
True if file is a symbolic link.
-r FILE
True if the file is readable by you.
-s FILE
True if file exists and is not empty.
-w FILE
True if the file is writable to you.
-x FILE
True if the file is executable by you.
-O FILE
True if the file is effectively owned by
you.
-G FILE
True if the file is effectively owned by
your group.
Type help test at the shell to see a complete list.
239
240
-z STRING
-n STRING
STRING1=STRING2
STRING1!=STRING2
STRING1<STRING2
STRING1>STRING2
-o OPTION
! EXPR
EXPR1 a EXPR2
EXPR1 o EXPR2
ARG1 OP ARG2
eq, -ne,
241
if [ condition] ; then
Do something
else
Do something else
fi
242
case variable in
pattern1)
do something ;;
pattern2)
do another thing ;;
esac
243
244
for I in {0..10}
Will use : 0,1,2,3,4,5,6,7,8,9,10
245
246
247
248
249
OLD_IFS=$IFS
IFS=$(echo)
<code>
IFS=$OLD_IFS
250
251
myFunction $filename
252
253
254
255
256
257
258
259
260
261
262
LUGs (bdlug)
http://www.redhat.com/training
http://www.redhat.com/training/developter/cours
es/
http://www.redhat.com/training/architect/courses
http://www.redhat.com/training/developter/cours
es/
http://www.idiom.com/free-compilers
http://www.redhat.com/apps/support/knowldedg
ebase
http://www.tldp.org
http://www.linuxquestions.org
263
264