Sunteți pe pagina 1din 124

LINUX TRAINING

Open Technology Centre,

National Informatics Centre,


E-3-A, DIT, MCIT, Govt of INDIA, a!a!i "havan, "esant Nagar, Chennai-#$$$%$&

Open Technology Centre, Chennai

Operating Systems A program that acts as an intermediary between a user of a computer and the computer hardware. Operating systems provide an environment in which a user can execute programs. A program that controls application programs. the execution of

OPERATING SYSTEM DESIGN

Open Technology Centre, Chennai

OPERATING SYSTEMS SERVICES


File Mangement I/O Management Memory Management Device Management esource Management !"# Management $ardware Management

Open Technology Centre, Chennai

Operating Systems Evolutions

MICROSOFT WINDOWS

OS/2

OPERATING SYSTEMS
LINUX DOS

OPERATING SYSTEM DESIGN

SOLARIS

MAC

Open Technology Centre, Chennai

Operating Systems View

OPERATING OPERATING SYSTEM SYSTEM DESIGN DESIGN

DETAILED OPERATING SYSTEM DESIGN

LINUX OPERATING SYSTEM DESIGN

Open Technology Centre, Chennai

IN!" vs #in$ows
Particular Software Cost Easy Reliability Free /Low Easy More Reliable than Windows Linux Costly Easier Required further improvement More but Cost Many More vulnerable to viruses/attacks No Better Support Windows

Sofware Tools Less Numbers but freely Hardware driver and user Few Interfaces Security Open Source Support Very few attacks Yes Less Compare to windows

Open Technology Centre, Chennai

IN!" ORIGIN

%inux is a &free' #nix(type operating system originally created by &Linus Torvalds with the assistance of developers around the world. August )* +,,+ &%inus' conceives the idea of %inux and announces the pro-ect.

Open Technology Centre, Chennai

INTRO%!CTION TO IN!" Open .ource. Modular Fashion. .trong .ecurity. .tructured File .ystems. Multi(#ser/ Multi(0as1ing Operating .ystem.

Open Technology Centre, Chennai

#&y IN!"'
%inux/ is a free/ #2I3(li1e operating system. 4or1s on any 1ind of $ardwares 5 "!/4or1stations /6mbedded .ystems/Mainframe7. !omes with complete development environment includes compilers/ tool1its/ scripting %anguages. %inux provides rich 8raphical #ser Interface 58#I7 .upport. .trong .ecurity ownership:s. 2ature 9 iptables/ file permissions/

Open Technology Centre, Chennai

IN!" ( AVO!RS

Open Technology Centre, Chennai

10

Type o) %istri*ution + Community E$ition

Open Technology Centre, Chennai

11

Type o) %istri*ution + Commeri,al E$ition

Open Technology Centre, Chennai

12

IN!" INSTA

ATION Multiple Operating system Multiple "artitions within an operating system Different file system types

Open Technology Centre, Chennai

13

IN!" -OOT SE.!ENCES

System Startup

B"O#

Sta e ! "##t L#a$er

Master Boot ecor!

Sta e 2 "##t L#a$er

$"$O, % &B

%er&e' I&(t

$in()

&ser ' #pace

Open Technology Centre, Chennai

14

IN!" -OOT SE.!ENCES / Run evels

A ru&'e)e' (s a s#*t+are ,#&*( urat(#& #* t-e system t-at a''#+s #&'y a se'e,te$ r#up #* pr#,esses t# e.(st/ I&(t ,a& ru& t-e system (& #&e #* s(. ru&'e)e's/ 0 1 -a't ! 1 S(& 'e user m#$e 2 1 Mu't(user2 +(t-#ut NFS 3T-e same as 42 (* y#u $#&5t -a)e &et+#r6(& 7 4 1 Fu'' mu't(user m#$e 8 1 u&use$ 9 1 X!! : 1 Re;##t
Open Technology Centre, Chennai 15

IN!" APP ICATION PAC0AGES Server


Database .erver 9 4eb .erver 9 Mail .erver 9 "roxy .erver 9 Firewall 9 20" .erver 9 D$!" .erver ( 2/4 information service ( 2/4 File .ystem ( 4indows File .hare ( emote !onnection ( "ostgre.;% Apache/ Apache 0omcat !yrus .<uid iptables ntp dhcp 2I. 2F. .amba open..$ .erver

Open Technology Centre, Chennai

16

IN!" APP ICATION PAC0AGES %es1top

Office .oftware 9 OpenOffice/ 1office 8raphics ( 8imp/!AD "rogrammes 5;!AD7 Internet =rowser 9 Mo>illa/ ?on<ueror 6mulation / @irtual 0erminal 9 ..$ Development 9 !/ !AA/ "erl / "ython B gcc 6ditor 9 6macs/ @i / @im .ound B @ideo 9 @%!/ =rasero Dics =urner Mail !lient 9 6volution !hat 9 6mpathy

Open Technology Centre, Chennai

17

IN!" (I E STR!CT!RE In the %inux operating system/ all filesystems are contained within one directory hierarchy. 0he root directory is the top level directory/ and all its subdirectories ma1e up the directory hierarchy. 0his differs to other operating systems such as M.(4indows. All directories are grouped under the root entry C/C.
Open Technology Centre, Chennai 18

IN!" (I E STR!CT!RE

Open Technology Centre, Chennai

19

IN!" (I E STR!CT!RE222 root home bin sbin proc ( 0he home directory for the root user ( !ontains the user:s home directories ( !ommands needed during bootup ( %i1e bin but not for normal users. ( Is a virtual filesystem that exists in the 1ernels imagination which is memory.
Open Technology Centre, Chennai 20

IN!" (I E STR!CT!RE222 usr ( !ontains all commands/ libraries/ pages and static files. #nchanging data files for programs and subsystems. 0he place for locally installed software and other files. Allows to mount the external partion.

lib (

local (

mnt (

Open Technology Centre, Chennai

21

IN!" (I E STR!CT!RE222 boot ( Files used by the bootstrap loader/ %I%O ?ernel images are often 1ept here. var ( Files in /var are dynamic and are constantly being written to or changed. etc ( !onfiguration files specific to the machine. dev ( !ontains device files for interfacing with hardware. 6ither bloc1 or character devices.

Open Technology Centre, Chennai

22

IN!" CON(IG!RATION (I ES
*etc*cronta+ ' L(sts ,#mma&$s a&$ t(mes t# ru& t-em *#r t-e ,r#& $eam#&/ ' E.p#rt(& *('e systems us(& NFS ser)(,e/ ' L(sts t-er *('e systems m#u&te$ at ;##t t(me Aut#mat(,a''y/ ' C#&ta(&s ;as(, r#up attr(;utes *#r system Gr#ups/ 1 Spe,(*(es t-e -#st&ames are res#')e$/

*etc*e)ports *etc*,sta+

*etc*gro(p

*etc*hosts-con,

Open Technology Centre, Chennai

23

IN!" CON(IG!RATION (I ES222 /et,/-#sts 1 '(sts -#sts *#r &ame '##6up t-at are '#,a''y Re<u(re$/ 1 C#&*( urat(#& *('e *#r (&(t2 ,#&tr#'s startup ru& Le)e's2 $eterm(&es s,r(pts t# start +(t-/ 1 T-e users $ata;ase ,#&ta(&s user&ame2 e&,rypte$ pass+#r$2 user $e*au't s-e''/users -#me $(re,t#ry/ 1 C#&ta(&s t-e *('es t-at are e.e,ute$ at startup t(me/
Open Technology Centre, Chennai 24

/et,/(&(tta;

/et,/pass+$

/et,/pr#*('e

IN!" CON(IG!RATION (I ES222 /et,/s-e''s 1 s-e''s *('e ,#&ta(&s a '(st #* 55 '# (& s-e''s 55 #& t-e system/ 1 *('e $(sp'ays t-e )ar(#us ,-ara,ter a&$ ;'#,6 $e)(,es ,urre&t'y ,#&*( ure$/ 1 Te''s a;#ut t-e 'ast '# (& t(me #& t-e System/ 1 C#&ta(&s system '# *('es/

/pr#,/$e)(,es

/)ar/'# /'ast'#

/)ar/'#

Open Technology Centre, Chennai

25

IN!" CON(IG!RATION (I ES222


*etc*rc-!*rc0-! *etc*rc-!*rc1-! *etc*rc-!*rc2-! *etc*rc-!*rc3-! *etc*rc-!*rc4-! *etc*rc-!*rc5-! *etc*rc-!*rc6-! ' C#&ta(&s t-e ru& 'e)e' 0/ ' C#&ta(&s t-e ru& 'e)e' !/ ' C#&ta(&s t-e ru& 'e)e' 2/ ' C#&ta(&s t-e ru& 'e)e' 4/ ' C#&ta(&s t-e ru& 'e)e' 8/ ' C#&ta(&s t-e ru& 'e)e' 9/ ' C#&ta(&s t-e ru& 'e)e' :/ *('e t-at are use$ t# ,#&tr#' at *('e t-at are use$ t# ,#&tr#' at *('e t-at are use$ t# ,#&tr#' at *('e t-at are use$ t# ,#&tr#' at *('e t-at are use$ t# ,#&tr#' at *('e t-at are use$ t# ,#&tr#' at *('e t-at are use$ t# ,#&tr#' at

Open Technology Centre, Chennai

26

IN!" 0ERNE ?ernel ( & heart of the operating system '

0he 1ernel image isn:t so much an executable 1ernel/ but a compressed 1ernel image. A routine that does some minimal amount of hardware setup and then decompresses the 1ernel contained within the 1ernel image and places it into high memory.

Open Technology Centre, Chennai

27

S3E S IN IN!" A shell is a program that provides the traditional/ text(only user interface for %inux and other #nix( li1e operating systems. Its primary function is to read commands that are typed into a console. 0ypes of shellsD E =ourne shell 5sh7 ( E ! shell 5csh7 ( E 0! shell 5tcsh7 ( E ?orn shell 51sh7 ( E =ourne Again .$ell 5bash7(

/bin/sh /bin/csh /bin/tcsh /bin/1sh /bin/bash

Open Technology Centre, Chennai

28

#or1ing in t&e (ile System @iewing the file system !reating files and Directories emoving files and Directories %in1ing Files !hange Directory %ist of Files !opy or Move files and Directories !lear .hell !ommands ?ernel version 6xit/ .hutdown B eboot
Open Technology Centre, Chennai 29

Viewing (ile system222456 tail ( Output the last part of files/ print the last part 5+F lines by default7 of each FI%6. 6xample +. tail /var/log/syslog Display the last +F lines of the file called syslog. ). tail (f /var/log/syslog (f ( output appended data as the file grows.

Open Technology Centre, Chennai

30

Viewing (ile system222476 less ( lets an admin scroll through configuration and error log files/ displaying text files. 6xD +. less /html/index.html more ( "aginates the specified file so it can be read line by line 5using 6nter 1ey7.#se b 1ey to move bac1 and < to <uit. 6xD ). more /home/html/index.html

Open Technology Centre, Chennai

31

Viewing (ile system222486 cat is to read and redirect the output to another file. 6xD cat /etc/hosts 9 "rints specified file to the screen. 6xD cat file.a G file.b ( cat is redirected using the output redirection operator.

Open Technology Centre, Chennai

32

Creating (ile an$ %ire,tories 456 touch ( create a simple empty file 6x D touch file(name t#u,- test/t.t

vim ( using vim editor create a file 6x D vim test.txt ,reates a empty t.t *('e (& t-e &ame #* test

Open Technology Centre, Chennai

33

Creating (iles an$ %ire,tories 476


m1dir ( !reate one or more directories. 6xD +. m1dir personal !reate a directory named personal 6xD ). m1dir (p wor1/-un1/<uestions !reate intervening parent directories if they don:t exist

Open Technology Centre, Chennai

34

Removing (iles an$ %ire,tory 456 rm 9 Allows the user to remove one or more files and and directories. 6xD 5+7 rm /home/index.html 9 Delete the File index.html 5)7 rm (rf /home/test/Des1top/testing ( Delete the file or directory force(fully
Note: (rf cause unrecoverable deletion/ If file is a directory/ remove the entire directory and all its contents/ including subdirectories.

Open Technology Centre, Chennai

35

in1ing (iles ln 9 used to ma1e lin1 between existing files. 6xD ln (s /home/otc/Des1top/test /mnt/

Open Technology Centre, Chennai

36

C&ange %ire,tory !hange the current wor1ing directory to dir2ame. 6xD cd /path/to/the/directory cd personal 9 change the directory into personal. cd .. ( =ac1 to the previous directory cd ( switch to the previous previous directory

Open Technology Centre, Chennai

37

ls / list 's L(st (&*#rmat(#& a;#ut t-e FILEs 3t-e ,urre&t $(re,t#ry ;y $e*au't7/ S#rt e&tr(es a'p-a;et(,a''y/ E. = !/ 's 1 L(st t-e ,#&te&ts #* a $(re,t#ry/

2/ 's 1'$ 1 C-e,6 t-e Perm(ss(#&s #* t-e $(re,t#ry/ 4/ 's 1a' 1 L(st t-e -($$e& ,#&te&ts #* a $(re,t#ry/

Open Technology Centre, Chennai

38

,p

/ ,opy 9 mv / move

,p ,#p(es *('es *r#m #&e '#,at(#& t# a&#t-er +(t-(& system E.= 3!7 ,p /-#me/test/Des6t#p/test/t.t /#pt/test/t.t/#r ( m) C#mma&$s *#r m#)(& *('es are *a(r'y stra( -t*#r+ar$/ T# ,-a& e t-e '#,at(#& #* a *('e2 use t-e m) ,#mma&$/ E.= 3!7 m) /-#me/test/Des6t#p/$#,ume&ts/#$t /$ata!

Open Technology Centre, Chennai

39

alias a'(as Create a& a'(as2 a'(ases a''#+ a str(& t# ;e su;st(tute$ *#r a +#r$ +-e& (t (s use$ as t-e *(rst +#r$ #* a s(mp'e ,#mma&$/ SYNTAX= a'(as >1p? >&ame>@)a'ue? ///? u&a'(as >1a? >&ame /// ? E. = !/ a'(as 's @ 5's 1F5 1 N#+ (ssu(& t-e ,#mma&$ 5's5 +('' a,tua''y ru& 5's 1F5
Open Technology Centre, Chennai 40

0ernel version

u&ame T-(s ,#mma&$ (s -e'p*u' +-e& +#r6(& #& $(**ere&t ,#mputers +-(,- may &#t ;e (& sy&,- at t-e OS 'e)e'/ A's#2 y#u ,a& pr(&t (&*#rmat(#& a;#ut t-#se systems/ E.= !/ u&ame 1a 1 T-(s +('' pr(&t t# t-e s,ree& t-e L(&u. %er&e' (& use #& y#ur system/

Open Technology Centre, Chennai

41

Clear S&ell Comman$s


,'ear C'ears y#ur s,ree& (* t-(s (s p#ss(;'e/ It '##6s (& t-e e&)(r#&me&t *#r t-e term(&a' type a&$ t-e& (& t-e term(&*# $ata;ase t# *( ure #ut -#+ t# ,'ear t-e s,ree&/

E.= 3!7 ,'ear

Open Technology Centre, Chennai

42

Re*oot: Powero)): S&ut$own reboot/halt/poweroff/shutdown halt or reboot is called when the system is not in runlevel F or H. 6xD 5+7 reboot or init H 9 eboot the system 5)7 poweroff 9 poweroff the system 5I7 shutdown (r * ( .hutdown the system in * minutes and reboot.

Open Technology Centre, Chennai

43

E;it an$ ogout exit 0he exit causes normal program terminate. logout 6xit a login shell. A login shell/ is your topmost shell/ and is started when you log in. 0erminate a login shell allow to logged out.

Open Technology Centre, Chennai

44

IN!" G!I

8nome ?D6

Open Technology Centre, Chennai

45

IN!" G!I 8nome 9 82# 2etwor1 Ob-ect Model 6nvironment 0he 82OM6 is a des1top environment/ a graphical user interface that runs on top of a computer operating system. 0he 82OM6 des1top environment/ an intuitive and attractive des1top for users/ and the 82OM6 development platform/ an extensive framewor1 for building applications that integrate into the rest of the des1top.

Open Technology Centre, Chennai

46

IN!" G!I / GNOME

Open Technology Centre, Chennai

47

IN!" G!I ?D6 ?D6 is the easier %inux 8#I for users with 4indows bac1ground. It is best 1nown for its "lasma Des1top/ a des1top environment provided as the default wor1ing environment on many %inux distributions/ such as open.#.6/ Mandriva %inux and ?ubuntu.

Open Technology Centre, Chennai

48

IN!" G!I / 0%E

Open Technology Centre, Chennai

49

A%VANTAGE O( IN!" G!I


It provides user friendly to the novice user. It invo1es multi(8#I environment in emote. 8#I allows to ta1e full advantages of multi( tas1ing. 4e can do all the !%I operations in 8#I mode. #sers are free to choose amoung many of 8#I:s such as 82OM6/ ?D6. More !ustomi>able. Any "roblem in 8#I/ we can ?ill 8#I B estart 8#I service.

Open Technology Centre, Chennai

50

Managing (ile Permissions


.etting File "ermissions .etting File Ownership

Open Technology Centre, Chennai

51

(ile Permission 456 In linux user can set file permissions/ they are read/ write and execute. If the command ls (l is given/ a long list of file names is displayed. 0he first column in this list details the permissions applying to the file. If a permission is missing for a owner/ group of other/ it is represented by exD drwxr(xJx
Open Technology Centre, Chennai 52

(ile Permission 476 ead KL 4rite K) 6xecute K +

Open Technology Centre, Chennai

53

(ile Permission 486 chmod changes the permissions of each given file according to MOD6. #ser 5rwx7 K LA)A+ K M 8roup5rx7 K LA+ K * 4orld 5rx7 K LA+ K * chmod mode K M**

Open Technology Centre, Chennai

54

(ile Permission 4<6 6xD 5+7 chmod LLL filename ( Allow read permission to everyone. 5)7 chmod FHH filename ( Ma1e a file rw by the group and others. 5I7 chmod MMM filename ( Allow everyone to rwx the file.

Open Technology Centre, Chennai

55

Setting (ile Owners&ip 456 !hange file owner and/or group. Nchown: changes the user and/or group ownership of each given File to 2ewOwner or to the user and group of an existing reference file. 6xD +. chown OownerP D OgroupsP targetQfileQname ). chown otcDotc /data+/index.html I. u 9 user/owner/ g 9 group/owner/ o9 all other r 9 read/ w 9 write/ x 9 execute a ( for allR user/owner/group and all other
Open Technology Centre, Chennai 56

Setting (ile Owners&ip 456


6xD 5I7 0o change the owner:s permissions of a files or directory chown uAr file.+ chown uAw file.+ chown uAx file.+ chown u(r file.+ chown u(w file.+ chown u(x file.+ 6xD 5L7 0o change the group:s permissions of a files or directory chown gAr file.+ chown gAw file.+ chown gAx file.+ chown g(r file.+ chown g(w file.+ chown g(x file.+ 6xD 5*7 0o change the permissions of a files or directory for everyone. chown oAr file.+ chown oAw file.+ chown oAx file.+ chown o(r file.+ chown o(w file.+ chown o(x file.+

Open Technology Centre, Chennai

57

!ser A$ministration

!reate user Delete user !reate 8roup Delete 8roup "assword oot login

Open Technology Centre, Chennai

58

!ser A$ministration 456 useradd Allows to create new user accounts 6xD 5+7 useradd test passwd change the password to the particular user. 6xD 5+7 passwd username

Open Technology Centre, Chennai

59

!ser A$ministration 476 groupadd Allows the user to create new group using the values specified on the command line. 6xD 5+7 groupadd user-name-to-add groupadd otc

Open Technology Centre, Chennai

60

!ser A$ministration 486 userdel Delete a user account and realted files 6xD userdel user(name groupdel Delete a group modifies the system files 6xD groupdel group(name

Open Technology Centre, Chennai

61

!ser A$ministration 4<6 passwd ( passwd is a text file/ that contains a list of the system:s accounts. Often/ it also contains the encrypted passwords for each account. 6xampleD passwd username 6nter new #2I3 passwordD EEEEEEEE !onfirm new #2I3 passwordD EEEEEEEE

Open Technology Centre, Chennai

62

!ser A$ministration 4=6 sudo or su ( sudo 5superuser do7 allows a system administrator to give certain users 5or groups of users7 the ability to run some 5or all7 commands as root or another user while logging the commands and arguments. 6xD +. sudo (i S6nter the "assword ( It:s use for debian and #buntu based linux. ). su ( S6nter the "assword ( It:s use for edhat/ suse/ mandriva based linux.
Open Technology Centre, Chennai 63

(ile System Management in inu;


@iewing Mounted Filesystem @iewing Dis1space #sage @iewing .pace by Files @iewing "artitions Finding Files

Open Technology Centre, Chennai

64

Viewing Mounte$ (ilesystem 456 mount #sed to view and mount the intend filesystem Instruct the 1ernel to attach the filesystem Mount allowed to access all devices/ partitions/ !D( OMs and other storage devices as files. 6xD 5+7 mount /dev/sdaM /mnt/ /$e)/s$aA B s#ur,e1$(re,t#ry 3-ar$1$(s6 part(t(#&7 /m&t B $est(&at(#&1$(re,t#ry #r m#u&t p#(&t 6xD 5)7 mount (a 9 Display Mount all filesystems. 6xD 5I7 mount (t extI /dev/sdaH /dis1.
Open Technology Centre, Chennai 65

Viewing Mounte$ (ilesystem 476 umount reverse process of mounting/ i.e unmount the partition. 6xD 5+7 umount /mnt /mnt 9 is the place where mount previously.

Open Technology Centre, Chennai

66

(ilesystem %is1 Spa,e !sage df ( Dis1 Free


@iewing Filesystem usage @iewing Available dis1 space. 6xD df (h


(h ( print si>es in human readable format 5e.g./ +?/ )ILM/ )87

Open Technology Centre, Chennai

67

Viewing %is1spa,e *y (iles du 9 Dis1 #sage du 5i.e./ dis1 usage7 command reports the si>es of directory trees inclusive of all of their contents and the si>es of individual files. 6xD 5+7 du /sbin/file+ 5)7 du (h /home

Open Technology Centre, Chennai

68

Viewing Partition Ta*le 456 fdis1 9 Format Dis1 Menu driven approach !reating B manipulate partition tables. "artitions are mentioned li1e /dev/sda 6xD 5+7 fdis1 (ls
%ist the partition tables for the specified devices and .i>e.

Open Technology Centre, Chennai

69

Viewing Partition Ta*le 476 cfdis1 cfdis1 is a curses/slang based partitioning any hard dis1 drive. 0ypical values of the device program for

argument

are

6xD 5+7 cfdis1 /dev/sda

Open Technology Centre, Chennai

70

(in$ing (iles grep 58rand egular 6xpression7 0he grep command searches one or more input files for lines containing a match to a specified pattern. 6xD 5+7 cat /etc/passwd T grep dso T-(s sear,-es *#r patter& spe,(*(e$/ I& t-(s ,ase a'' (&sta&,es #* $s# *r#m t-e /et,/pass+$ *('e are pr(&te$/

Open Technology Centre, Chennai

71

(in$ing (iles 456 grep (i &.ample' /home/dsoneil 0he (i option ma1es the search in different to case 5e.g.sample or .AM"%67

Open Technology Centre, Chennai

72

(in$ing (iles 476 find #sed to locate files on a #nix or %inux system. .earch any set of directories you specify for files that match the supplied search criteria. 6xD 5+7 find / (name log (print ( find the file log in the wholo system and prints it.

Open Technology Centre, Chennai

73

w&o
+-# S-#+ +-# (s '# e$ (&t# t-e system/ W(t- &# #pt(#&s2 '(st t-e &ames #* users ,urre&t'y '# e$ (&2 t-e(r term(&a'2 t-e t(me t-ey -a)e ;ee& '# e$ (&2 a&$ t-e &ame #* t-e -#st *r#m +-(,- t-ey -a)e '# e$ (&/ A& #pt(#&a' system *('e 3$e*au't (s /et,/utmp7 ,a& ;e supp'(e$ t# ()e a$$(t(#&a' (&*#rmat(#&/ E. = !/ +-# 1uC

Open Technology Centre, Chennai

74

w&i,& +-(,+-(,- ta6es #&e #r m#re ar ume&ts/ F#r ea,- #* (ts ar ume&ts (t pr(&ts t# st$#ut t-e *u'' pat- #* t-e e.e,uta;'es t-at +#u'$ -a)e ;ee& e.e,ute$ +-e& t-(s ar ume&t -a$ ;ee& e&tere$ at t-e s-e'' pr#mpt/ E.= !/ +-(,- 1a *('e&ame 1 T-(s +('' sear,- t-r#u - a'' $(re,t#r(es (& y#ur ,urre&t pat- a&$ *(&$ a'' *('es &ame$ *('e&ame

Open Technology Centre, Chennai

75

(in$ing (iles 486 locate %ocate lists files in a database that match a pattern 6xD 5+7 locate wordperfect T-e '#,ate ,#mma&$ +('' '#,ate t-e *('e spe,(*(e$ a&$ #utput a $(re,t#ry pat-/

Open Technology Centre, Chennai

76

Pro,ess Management in inu;

@iewing unning .ervices and @iewing unning "rocess ?illing a unning "rocess

unlevel

Open Technology Centre, Chennai

77

Viewing Running Pro,ess 456 top "rovides an outgoing loo1 at processor activity and update dynamically. %isting of the process based on !"# usage Memory usage untime. !an monitor process belongs to the specific process id.

Open Technology Centre, Chennai

78

Viewing Running Pro,ess 476 6xD5+7 top (p process(id

"rovides the information about process whose pid is as input.

Open Technology Centre, Chennai

79

Viewing Running Pro,ess 486 ps 6numerates the currently running processes. "rocess are identified by its id 5pid7. %ist the "rocess with its id/ state/ usage too. 6xD 5+7 ps au a 9 lists all process u 9 select by effective user(id

Open Technology Centre, Chennai

80

Viewing Running Pro,ess 4<6 4e can combine ps with grep to find a process by name. 6xD 5+7 ps aux T grep soffice

%ists the process whose name is soffice. %ist the "rocess with its id/ state/ usage too.

Open Technology Centre, Chennai

81

0ill a Running Pro,ess 456


ps is most often used to obtain the "ID. using pid 1ill/terminate a unintended process. if the "ID of a program is found to be ++)* combine ps with grep to find a process by name.

6xD 1ill process(id 5+7 ?ill (, ++)*

Open Technology Centre, Chennai

82

Networ1 Management in inu;


@iewing 2etwor1ing !onfigurations @iewing outing 0ables @iewing 2etwor1 .ervices and "orts

Open Technology Centre, Chennai

83

Intro$u,tion to Networ1ing 2etwor1 commands useful when networ1ing with other computers. 4ithin the networ1 and across the internet/ obtaining more information about other computers.

Open Technology Centre, Chennai

84

-asi, Networ1ing Comman$s


(*,#&*( p(& te'&et $( &s'##6up tra,er#ute -#st&ame

Open Technology Centre, Chennai

85

Viewing Networ1 Con)igurations 456 ifconfig ( used to configurations.

configure

and

view

networ1

6xD 5+7 ifconfig (a ( shows the networ1 interface about the machine.

Open Technology Centre, Chennai

86

Viewing Networ1 Conne,tions 476 ping .ends an I!M" 6!$OQ 6;#6.0 pac1et to the specified host. If the host responds/ you get an I!M" pac1et bac1. 6xD 5+7 ping xxx.xxx.xxx.xxx 5xx ( ip address or hostname7

Open Technology Centre, Chennai

87

Viewing Networ1 Conne,tions 476

telnet ( ability to remotely log in and wor1 on another computer. 6xD telnet ipQnumber portQnumber 5+7 telnet +F.+HI.+L.*U )+ a's# te'' +-et-er t-e p#rt (s #pe&e$ #r &#t/

Open Technology Centre, Chennai

88

Viewing Networ1 Conne,tions 486 dig Is a D2. loo1up utility used to perform D2. loo1up and return the output from the internet servers. 6xD dig www.gmail.com

Open Technology Centre, Chennai

89

Viewing Route In)ormations 456 route .how and manipulate the routing tables. It manipulates the I" routing table and set up the routing to the specific hosts in the networ1. Allows the user to modify the routing table manually using add or del options.

Open Technology Centre, Chennai

90

Viewing Route In)ormations 476 netstat Output the networ1 statistics includes routing table tables/ interface statistics. "rint the list of open ports 6xD 5+7 netstat (pant ( 4ill display the currently opened ports in the system.

Open Technology Centre, Chennai

91

Viewing Route In)ormations 486 traceroute ( networ1 diagnostic tool. traceroute displays each host that a pac1et travels through as it tries to reach its destination. 6xD 5+7 traceroute www.google.co.in ( .hows each host will be displayed/ along with the response times at each host.

Open Technology Centre, Chennai

92

Viewing Route In)ormations 4<6 nsloo1up ;uery the internet domain name servers for getting about the various hosts in the networ1. 6xD nsloo1up domain name 5+7 nsloo1up mail.nic.in

Open Technology Centre, Chennai

93

S&ell an$ Remote Copy


.ecure .hell 5ssh7 .ecure !opy rsync

Open Technology Centre, Chennai

94

Se,ure S&ell ssh Allows logging into remote machine "rovides secure encrypted communications Must need an identity

6xD ssh usernameVip(address 5+7 ssh otcV+F.+HI.+L.+FF

Open Technology Centre, Chennai

95

Se,ure Copy scp


scp copies files between hosts on a networ1. use ssh for data transfer provides security as ssh. scp will as1 for passwords for authentication. /data+

6xD 5+7 scp (r rootV+F.+HI.+L.*UD/home/otc/Des1top

Open Technology Centre, Chennai

96

rsyn,

rsync is focused on synching data from one dis1 location to another. rsync remote(update protocol allows rsync to transfer -ust the differences between two sets of files across the networ1 lin1.

6xD 5+7 rsync (av> rootV+F.+HI.+L.*MD/data /data/tmp

Open Technology Centre, Chennai

97

(ile Ar,&iving in inu;


File archiving !reating !ompressed Files

Open Technology Centre, Chennai

98

(ile Ar,&iving 456 tar 0he tar 5tape archive7 command bundles a bunch of files together and creates an archive. 6xD 5+7 tar B, B) B* (cvf archives.tar archives/ 1 Create a tar *('e 1 Der;#se M#$e 1 F('e Name

Open Technology Centre, Chennai

99

(ile Ar,&iving 476 6xD 5)7 tar (tvf archives.tar 0o view files in tar file. 6xD 5I7 tar (xvf archives.tar x 9 6xtract the tar contents. 6xD 5L7 tar (rvf archives.tar testing.txt r 9 Append files to existing tar file.

Open Technology Centre, Chennai

100

(ile Ar,&iving 486 dd whose primary purpose is the low(level copying.

It can also be used in computer forensics. !an snapchot magnetic pattern of an entire dis1 needs to be preserved as a byte(exact copy.

Open Technology Centre, Chennai

101

(ile Ar,&iving 4<6 $ard Dis1 !lone dd ifK/dev/sda ofK/dev/sdb :: of :: is the distination and ::if :: is the source. "artition !lone dd ifK/dev/sda+ ofKW/dis1).img =ac1ing up a hard dis1 partition is much similar to bac1ing up a whole hard dis1.
Open Technology Centre, Chennai 102

(ile Ar,&iving 4=6 estoring from an Image File 0o restore a partition or a hard dis1 from an image file/ -ust exchange the arguments CifC and CofC For example/ restore the whole hard dis1 from the image file Cdis1+.imgC 6x 5+7D dd ifKdis1).img ofK/dev/sda

Open Technology Centre, Chennai

103

>ip
>ip 0he >ip program puts one or more compressed files into a single >ip archive/ along with information about the files 5name/ path/ date/ time of last modification/ protection/ and chec1 information to verify file integrity7. An entire directory structure can be pac1ed into a >ip archive with a single command. !ompression ratios of )D+ to ID+ are common for text files. . 6xD 5+7 >ip (r foo foo.>ip

Open Technology Centre, Chennai

104

un>ip
un>ip #n>ip is to extract into the current directory 5and subdirectories below it7 all files from the specified XI" archive. 6xD 5+7 un>ip foo.>ip foo

Open Technology Centre, Chennai

105

Mis,

Debugging 0ime Management !ommand eboot/ "oweroff/ .hutdown .hells "rinting Man "ac1age Installation

Open Technology Centre, Chennai

106

%e*ugging 456 dmesg

Display the system control messages from the 1ernel ring buffer. 0his buffer stores all messages since the last system boot/ or the most recent ones

6xD 5+7 dmesg

Open Technology Centre, Chennai

107

Time Management

hwcloc1 ( .et or read the hardware !MO. !loc1. uptime ( reports how long the system is running cloc1 ( used to set or get current time. tset ( used to set the users private time Xone. w 9 %ists users currently logged into the system.

Open Technology Centre, Chennai

108

Printing System

!#". ( !ommon #2I3 "rinting .ystem

!#". is a open source printing system developed by Apple Inc.

!#". is the applications.

software

use

to

print

from

Open Technology Centre, Chennai

109

Printing System 456

Access the 4eb Interface for "rinting. !#". provides a web interface/ that allows you to view print -obs/ printers/ and the online help/ as well as manage your printers. 0he !#". web interface is available on your machine at the following # %D http'((localhost'#3)

Open Technology Centre, Chennai

110

Printing System 476 lpr submits files for printing/ If no files are listed on the command(line/ lpr reads the print file from the standard input. 6xD 5+7 lpr /home/html/index.html
B T-(s ,#mma&$ +('' pr(&t t-e *('e (&$e./-tm' t# t-e pr(&ter/

5)7 lprm +)
B T-(s ,#mma&$ +('' ,a&,e' p(&t E#; !2 (& t-e pr(&ter <ueue/

5I7 lp<
B S-#+ t-e ,#&te&ts #* t-e pr(&t <ueue/
Open Technology Centre, Chennai 111

man man is the systemYs manual pager. 6ach page argument given to man is normally the name of a program/ utility or function. 0he manual page associated with each of these arguments is then found and displayed. A section/ if provided/ will direct man to loo1 only in that section of the manual. 0he default action is to search in all of the available sections/ following a pre(defined order and to show only the first page found/ even if page exists in several sections.

Open Technology Centre, Chennai

112

PAC0AGE INSTA

ATION

Install pa,1ages )rom sour,e 0he installation procedure for software that comes in tar.g> and tar.b>) pac1ages isn:t always the same/ but usually it:s li1e thisD S S S S S tar xv>f pac1age(name.tar.g> cd pac1age(name ./configure ma1e ma1e install
Open Technology Centre, Chennai 113

PAC0AGE INSTA

ATION 476

Install pa,1age )rom u*untu repository S sudo apt(get update ( update ubuntu repository S sudo apt(get install Z"ac1age 2ameG S sudo apt(get install apache) ( Install apache webserver from repository

Open Technology Centre, Chennai

114

PAC0AGE INSTA

ATION 486

Remove Pa,1age S sudo apt(get remove apache) ( remove pac1ages from system S sudo apt(get remove ((purge apache ( remove pac1ages with configuration files.

Open Technology Centre, Chennai

115

Server

Apache 4ebserver "ostgre.;% Open..$ .erver D$!" .erver F0" .erver

Open Technology Centre, Chennai

116

APAC3E SERVER

We; ser)er Fu''y #pe& s#ur,e De)e'#pe$ ;y Apa,-e S#*t+are F#u&$at(#& D(re,t()es t-at ,#&tr#' t-e ,#&*( urat(#& #* Apa,-e/ Se,ure S#,6ets Layer/

Open Technology Centre, Chennai

117

POSTGRES. SERVER
P#st reSFL (s a p#+er*u'2 #pe& s#ur,e re'at(#&a' $ata;ase system/ It ru&s #& a'' maE#r #perat(& systems2 (&,'u$(& L(&u.2 UNIX 3AIX2 "SD2 CP1UX2 SGIIRIX2 Ma, OS X2 S#'ar(s2 Tru:872 a&$ W(&$#+s/ P#st reSFL ;#asts s#p-(st(,ate$ *eatures su,- as Mu't(1Ders(#& C#&,urre&,y C#&tr#' 3MDCC72 p#(&t (& t(me re,#)ery2 ta;'espa,es2 asy&,-r#&#us rep'(,at(#&2 &este$ tra&sa,t(#&s 3sa)ep#(&ts7/ Pa,6a es *#r P#st reSFL ,#me +(t- ma&y L(&u. $(str(;ut(#&s2 a&$ (t ,a& ;e ,#mp('e$ a&$ (&sta''e$ #& a'm#st a'' )ar(et(es #* U&(./

Open Technology Centre, Chennai

118

POSTGRES. SERVER
P#st reSFL ,#&s(sts #* a ser)er pr#,ess t-at rea$s a&$ +r(tes t-e a,tua' $ata;ase *('es2 a&$ a set #* ,'(e&t pr# rams t-at ,#mmu&(,ate +(t- t-e ser)er/ A'' #* t-e P#st reSFL $ata;ase *('es are st#re$ u&$er a $(re,t#ry su,- as /)ar/'(;/p s<' #r /usr/'#,a'/p s<'/ T-e m#st (mp#rta&t (s p G-;a/,#&*2 +-(,- '(sts ,'(e&t -#sts t-at are a''#+e$ t# ,#&&e,t t# t-e ser)er/ T-(s m#$u'e a''#+s a& a$m(&(strat(#& t# ma&a e $ata;ases2 ta;'es2 *(e'$s a&$ re,#r$s (& a P#st reSFL ser)er/

Open Technology Centre, Chennai

119

OpenSS3 Server Se,ure S-e'' #r SSC (s a &et+#r6 pr#t#,#' t-at a''#+s $ata t# ;e e.,-a& e$ us(& a se,ure ,-a&&e' ;et+ee& t+# &et+#r6e$ $e)(,es/ E.= !/ ss- userH-#st 2/ ss- 1p userH-#st B ,#&&e,t t# -#st #& p#rt as user/ 4/ ss-1,#py1($ userH-#st B a$$ y#ur 6ey t# -#st *#r user t# e&a;'e a 6eye$ #r pass+#r$'ess '# (&/
Open Technology Centre, Chennai 120

%3CP SERVER

DCCP 1 Dy&am(, C#st C#&*( urat(#& Pr#t#,#'/ Pr#)($es a$)a&,e$ IP a$$ress a''#,at(#& a&$ ma&a eme&t *#r TCP/IP LAN ,#mput(& e&)(r#&me&ts/ T-(s pr#t#,#' sa)es t-e system a$m(&(strat#r mu,- t(me -a)(& t# ma&ua''y ,#&*( ure ea,- -#st +#r6stat(#& ma&ua''y2 a&$ t# ma(&ta(& 'ar e $ata;ases st#r(& IP ass( &me&t $eta('s/

Open Technology Centre, Chennai

121

(TP SERVER

FTP 3F('e Tra&s*er Pr#t#,#'7 (s t-e s(mp'est a&$ m#st se,ure +ay t# e.,-a& e *('es #)er t-e I&ter&et/ T-e m#st ,#mm#& use *#r FTP (s t# $#+&'#a$ *('es *r#m t-e I&ter&et/

FTP Types= A,t()e Pass()e Asy&,-r#&#us

Open Technology Centre, Chennai

122

.?A SESSION

Open Technology Centre, Chennai

123

T&an1 you

Open Technology Centre, Chennai

124