Professional Documents
Culture Documents
Ch.1
History
1984 GNU project began by Richard Stallman, write replacement tools
for Unix like (chmod, ls)
They put these S/W under GPL which have 4 freedom (write to use,
modify, redistribute, distribute modifications.
1991 linus trovalds (Finland) develop Linux kernel "ver. 0.02 now
2.6 "
Complete open source + unix like O.S = Linux kernel + GNU unities
Red hat distributions
RHEL
FEDORA
There are now around 200 Linux distributions.
To obtain kernel www.kernel.org
Kernel naming X.Y.Z
X major no.
Y minor no. If even it is stable else it is a
development kernel
Z release
CH.2
Basics
Two types of login virtual console (text)
GUI login "display manager" gdm
start GNONE desktop
To switch between V.C's & GUI environment alt + ctrl + F1 F7.
Desktop environment is a collection of configurations and tools that
define how a graphical environment should like .
X server (desktop) will start on ctrl + alt + F7.
To change your password system preferences about me OR
#passwd
To login by another identity #su username
Text editor nano , gedit , emacs, vi
#date -- help
non essential
/sbin (Essential), /usr/sbin, /usr/local/sbin (system exec. Files)
S/W compiled from source
/mnt, /media (removable) (mount points )
/etc (Configuration files)
/tmp (delete after 10 dyes)
/boot (Kernel and boot files)
Log, mail, spool
/var, /srv (DB, apache) (server data )
/proc, /sys (H/W) (system info.)
/lib, /usr/lib, /usr/local/lib shared lib.
Ch.5
User & Group & permissions
Uid of root is 0
Users have uid, gid, home directory ,login shell in /etc/passwd,
/etc/group
Private group has the same user name
Permission precedence uid, gid, other
#chmod Permission file/dir.
4 r read list "ls"
2 w write create /remove
1 x exit cd & ls - l
#chown [ - R] mm file
#chgrp [ - R] frinds file
#chmod [ - R ] augo rwx file
a all
u owner
g group
o other
= assign
+ add
- remove
#chmod 644 file
Ch.6
Using bash shell
Wild card expansion
* replace zero or more character
? replace one character
[0 9] replace one digit from 0 to 9
[abc] replace one char. (a or b or c)
[^ abc] not
[: keyword:] keyword alpha, upper, lower, digit, alnum,
Space
Ex. [[: digit]] or [^ [: alpha:]]
Tab completion "commands & file names"
#history
Ch.7
Redirection & pipes & for
standard i/p file describtor 0 , <
o/p file describtor 1, >, >>
&> o/p & error
Error file describtor 2, 2>, 2>>
find /etc - name passwd > find.out 2> find.err
pipe "|"
#echo "test print" | lpr
#echo "test mail" | mail s "test" root
#find /etc name passwd &> find all redirect all
# (cal 2007, cal 2008) | less combine out of multiple commands
tee
#tr "A Z " "a z" < test file i/p redirection
#cat test file | tr "A Z" "a z"
#cat < file # cat file
#cat > file output redirection
$mail s " test" root@example.com << END
> Hi
> man
> END sendins multiple lines to STDIN
$
for name in ali mm nn
do
echo welcome | mail s testmail $name
done
for n in ` cat file `
do
echo "$n"
done
for n in {1..20}
do
ip=10.0.0.$n
ping c2 $ip &> /dev/null
if {$? = 0}, then
echo" $ip is up"
else
echo "$ ip is down"
fi
done
Ch.8
Text processing tools
#cat file1 file2 file3 "concatenate"
If #cat "binary file" terminal will unusable so use #reset
#cat b
Number each line
#head n /etc/passwd
#tail n /etc/passwd
f
#grep mm /etc/passwd
-i case insensitive ,
- n print line numbers of match,
- v not contain , - c count
-r recursive , - l only files names
-AX print line after match
-BX print line before match
#cat d: - f1 /file
#cat d" c2 5 /file
#ifconfig 1 grep 'inet addr' 1 cat d: - F2 1 cat d " " F1
#wc l
w
c
m char. cont "not displayed"
#sort r reverse
n numeric
u uniq
t: use ":" as a filed separator
k x sort by ":" delimited filed x
#sort t: - k 3 n /etc/passwd uid field
#sort t: - k 3.2 n /etc/passwd
Ch.9
Vim
Adv. : speed , most unix types
Disadv. : difficult
Modes command
Insert
Ex mode
Esc exit current mode & esc esc exit to
command mode
Insert mode A append end of line , a after the cursor
I append begin of line it before the
curser
O inserts new line
Ex. :w
: wq
: q!
Command mode
w move word
b move word
G jumb to end
2G jumb to line 2
() move by sentence
{} move by paragraph
Ch.10
#ifconfig eth0
#ifup eth0
#ifdown eth0
#systemconfignetwork deactivate activate
#nano /etc/sysconfig/networkscripts/ifcfgeth0
#service network restart
#dhclient
#nano /etc/sysconfig/network
#route add default gw 10.0.0.1
#ifconfig eth0 10.0.0.2
#nano /etc/resolv.conf
Ch.11
Processes
PID
UID & GID & SE Linux context determine F.S access which
inherit from the executing user
#ps a x u f
(a) all terminals
(x) process not attached to terminal
(u) display process owner
(f) print process parent
e all
elfy more info.
o pid, comm., %cpu, %mem, state, tty
Process status
Running use CPU now .
Sleeping in memory but not doing any thing.
"Error uninterruptible sleep" waiting for resource to because available
[wait for an event] (ex. I/O over fail net
NFS connection.
Zombie terminated but not flushed from process
list.
Ch.12
Configure bash shell
Variables
#m="hellow"
Variable 1) local var. "shell var."
2) Environment var.
(1) Local var. user to configure the shell itself
(2) Shell will pass env. var. to the program that call it used to
configure other commands
#set display all var.
#env display env. var.
#echo $HOME display single var.
Ex: - env. var
PSI ="\a, \h" prompt
\a username
\w current working dir.
\h hostname
Ch.13
Find
#locate name (updatedb daily executed from /etc/updatedb.conf)
- i case insensitive
- n x list only the first x matches
#find [dir.] [criteria] [action]
Only search dir. where the user has read & execute permission
#find / perm 022 exec chmod o w { } \;
ok
User
Ch.14
Web client
Firefox features fast, popup blocking, tabbed browsing
# links http:// www.redhat.com show the site
# Links dump http:// www.redhat.com show then exit
# links source http:// www.redhat.com show source
# wget http:// www.redhat.com/index.html
# wget recursive -- level = 1 http:// www.site.com
Evolution email client "in fedora"
Thunderbird email client "mozilla email client"
Kmail KDE email client
Mutt non Gui email client [#mutt f imaps://user@server]
Gaim or kopete IM tools support msn, yahoo, icq, irc.
RH client RH server
#ssh root@IP ['command'] allow authenticated, encrypted access to
remote system
# scp source destination
user@host:/path
r recursive
#sftp
#rsync fuster than scp it capies difference
a recursive
-- Progress print progress bar
Ch.15
Advanced users & permissions
/etc/passwd UID, gid
/etc/group
/etc/shadow
# systemconfigusers
# useradd
# usermod
# userdel
#w show connected users
# last show recent login
# lastb show last bad login
Special permission for executable suid run with owner
perm.
sgid run with group
owner perm.
Special permission for directions sticky
sgid
1 sticky
2 sgid
4 suid
Ch.16
Linux file system
Inode table contain inode entries which contain file type , UID, GID,
size, time stamps, pointers to the file's data blocks on disk, permission,
link count
Directory is a map between human name & inode number
# ls il
Hard links
Adds an additional pathname to reference a single file per file system
# ln filename [link name]
Soft links "symbolic"
A file that points to another file "its symbol is l"
# ln s filename link name
# df h disk partitions usage
# du hs directory & files usage in kilobyte
# mount
# zip & # unzip
# gzip & # gunzip
#bzip2 & # bunzip2
# tar c create
t list
x extract
v verbose
f archive name
z compress
Ch.17
System admin tools
Installation
# service
# chkconfig
# Systemconfigservices
# rpm
# yum
# priut adds /removes S/W
Selinux
Firewall # system-configsecuritylevel