68
8/7/2019 01_intro to linux http://slidepdf.com/reader/full/01intro-to-linux 1/68 + An Introduction to Linux 

01_intro to linux

Embed Size (px)

Citation preview

Page 1: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 1/68

+

An Introduction to

Linux 

Page 2: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 2/68

+Contents

n A quick guide to Linux

n Background

n Using Linux

n Linux in the Marketplace

n Commercial Linux Applications

n Additional Resources 

2

Page 3: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 3/68

Page 4: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 4/68

+Where did it come from?

n  Linus Torvalds created it

n  with assistance from programmers around the world

n  first posted on Internet in 1991

n  Linux 1.0 in 1994; 2.2 in 1999

n  Today used on 7-10 million computers

n  with 1000s of programmers working to enhance it

4

Page 5: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 5/68

+Open Source Software

n  When programmers on the Internet can read, redistribute, andmodify the source for a piece of software, it evolves 

n  People improve it, people adapt it, people fix bugs. And thiscan happen at a speed that, compared to conventionalsoftware development, seems astonishing 

5

Page 6: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 6/68

+How do you get it?

n  Download it from the Internet

n  From a Distribution (e.g. Debian)

n  Linux kernel

n  X Windows system and GUI

n  Web, e-mail, FTP servers

n  Installation & configuration support

n  3rd party apps

n  Hardware support

6

Page 7: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 7/68

+Why is it significant?

n  Growing popularity

n  Powerful

n  Runs on multiple hardware platforms

n  Users like its speed and stability

n  No requirement for latest hardware

n  It’s free 

n  Licensed under GPL

n  Vendors are distributors who package Linux

7

Page 8: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 8/68

+Logging In

n  Connect to the Linux system using telnet:

n  vt100, vt220, vt320

n  ansi

n  tty

n  X-windows

n  Able to login more than once with same user

8

Page 9: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 9/68

+Logging In

n  Before you can use it you must login by specifying youraccount and password:

Linux 2.2.13 (penguinvm.princeton.edu) (ttyp1)

penguinvm login: nealePassword:Last login: Tue Jan 4 10:13:13 from

linuxtcp.princeton.edu[neale@penguinvm neale]$ 

9

Page 10: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 10/68

+Rule Number 1

n  Do not login as root unless you have to

n  root is the system superuser (the maint of Linux but moredangerous)

n  Normal protection mechanisms can be overridden

n  Careless use can cause damagen  Has access to everything by default

n  root is the only user defined when you install

n  First thing is to change roots password

n  The second job is to define normal users for everyday use

10

Page 11: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 11/68

+Creating a new user 

n  Use the useradd command

n  Use the passwd command to set password

n  Try it… logon as root 

[root@penguinvm]# useradd scully[root@penguinvm]# passwd scullyChanging password for user scully

New UNIX password:

Retype new UNIX password:passwd: all authentication tokens updatedsuccessfully[root@penguinvm]# 

11

Page 12: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 12/68

+Adding a new user 

n  Limits on users can be controlled by

n  Quotas

n  ulimit command

n  Authority levels for a user controlled by group membership

12

Page 13: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 13/68

+Users and Groups

n Users are identified by user identifications (UIDs), eachof which is associated with an integer in the range of 0 to

4 294 967 295 (XFFFFFFFF). Users with UID=0 aregiven superuser privileges. "

n Users are placed in groups, identified by groupidentifications (GIDs). Each GID is associated with aninteger in the range from 0 to 4 294 967 295"

n Let the system assign UID to avoid duplicates"n Use id to display your user and group information"

uid=500(neale) gid=500(neale) groups=500(neale),3(sys),4(adm) 

13

Page 14: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 14/68

+Users and Groups

n Groups define functional areas/responsibilities

n They allow a collection of users to share files

n A user can belong to multiple groups

n You can see what groups you belong to using

the groups command:"neale sys adm 

14

Page 15: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 15/68

+Using the new user 

n  Now logoff using the exit command

n  login as the new user

Linux 2.2.13 (penguinvm.princeton.edu) (ttyp2)

penguinvm login: scully

Password:[scully@penguinvm scully]$ 

15

Page 16: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 16/68

+You need help?

n  The Linux equivalent of HELP is man (manual)

n  Use man -k <keyword> to find all commands with that keyword

n  Use man <command> to display help for that command

n  Output is presented a page at a time. Use b for to scrollbackward, f or a space to scroll forward and q to quit 

16

Page 17: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 17/68

+The Linux System

User commands includesexecutable programs and

scripts

The shell interprets usercommands. It is responsible

for finding the commandsand starting their execution.Several different shells areavailable. Bash is popular, 

The kernel manages thehardware resources for the rest

of the system. 

User commands

Shell

Kernel File Systems

Device Drivers

Hardware

17

Page 18: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 18/68

+Linux File System Basics

n Linux files arestored in a single

rooted, hierarchical

file systemn Data files are stored

in directories (folders)

n Directories may be

nested as deep asneeded

Directories

User home

directories

Data files

root 

18

Page 19: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 19/68

+Naming Files

n Files are named by

n naming eachcontaining directory

n starting at the root

n This is known as thepathname  

/etc/passwd 

/home/neale/b 

19

Page 20: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 20/68

+The Current Directory

n One directory isdesignated thecurrent working 

directory n if you omit the

leading / then pathname is relative to thecurrent working

directoryn Use pwd to find out

where you are

Current

workingdirectory

doc/letter

./doc/letter

/home/neale/doc/letter 

20

Page 21: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 21/68

+Some Special File Names

n  Some file names are special:

n  / The root directory (not to be confused with the rootuser)

n  . The current directory

n  .. The parent (previous) directory

n  ~ My home directory

n  Examples:

n  ./a same as a 

n  ../jane/x go up one level then look in directory jane forx 

21

Page 22: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 22/68

+Special Files

n /home - all users home directories are stored here

n /bin, /usr/bin - system commands

n /sbin, /usr/sbin - commands used by sysadminsn /etc - all sorts of configuration files

n /var - logs, spool directories etc.

n /dev - device files

n /proc - special system files 

22

Page 23: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 23/68

+Linux Command Basics

n  To execute a command, type its name and arguments at thecommand line

ls -l /etc 

Command name Options

(flags)

Arguments

23

Page 24: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 24/68

+Standard Files

n  UNIX concept of standard files 

n  standard input (where a command gets its input) - default is theterminal

n  standard output (where a command writes it output) - default is the

terminaln  standard error (where a command writes error messages) - default

is the terminal

24

Page 25: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 25/68

+Redirecting Output

n  The output of a command may be sent (piped) to a file:

ls -l >output > is used to specify

the output file

25

Page 26: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 26/68

+Redirecting Input

n  The input of a command may come (be piped) from a file:

wc <input < is used to specify

the input file 

26

Page 27: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 27/68

+Connecting commands with

Pipes

n  Not as powerful as CMS Pipes but the same principle

n  The output of one command can become the input of another:

ps aux | grep netscape | wc -l

The output of the ps command is sent to

grep grep takes input and searches for 

netscape passing these lines to wc 

wc takes this input andcounts the lines its output

going to the console

Like CMS Pipes, | is

used to separate stages

27

Page 28: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 28/68

+Command Options

n  Command options allow you to control a command to a certaindegree

n  Conventions:

n  Usually being with a single dash and are a single letter (-l

)

n  Sometimes have double dashes followed by a keyword (--help)

n  Sometimes follow no pattern at all

28

Page 29: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 29/68

+Common Commands

n pwd - print (display) the working directory

n cd < dir> - change the current working

directory to dir  n ls - list the files in the current working

directory

n ls -l - list the files in the current workingdirectory in long format

29

Page 30: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 30/68

+File Commands

n cp <fromfile> <tofile>  n Copy from the <fromfile> to the <tofile>

n mv <fromfile> <tofile>  n 

Move/rename the <fromfile> to the <tofile>n rm <file>  n Remove the file named <file>

n mkdir <newdir>  n Make a new directory called <newdir>

n rmdir <dir>  n Remove an (empty) directory 

30

Page 31: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 31/68

+More Commands

n who n List who is currently logged on to the system

n whoami n 

Report what user you are logged on asn ps n List your processes on the system

n ps aux n List all the processes on the system

n echo    A string to be echoed     n Echo a string (or list of arguments) to the terminal 

31

Page 32: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 32/68

+More Commands

n  awk - a file processing language that is well suited to datamanipulation and retrieval of information from text files

n  chown - sets the user ID (UID) to owner for the files anddirectories named by pathname arguments. This command is

useful when from test to production

chown -R apache:httpd /usr/local/apache!

32

Page 33: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 33/68

+More Commands

n  diff - attempts to determine the minimal set of changesneeded to convert a file specified by the first argument into thefile specified by the second argument

n find -

 

Searches a given file hierarchy specified by path,finding files that match the criteria given by expression

33

Page 34: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 34/68

+More Commands

n  grep - Searches files for one or more pattern arguments. Itdoes plain string, basic regular expression, and extendedregular expression searching"

 find ./ -name "*.c" | xargs grep -i "fork"!In this example, we look for files with an extension c (that is, C source files). The filenames wefind are passed to the xargs command which takes these names and constructs a command line

of the form: grep -i fork <file.1>…<file.n> . This command will search the files for theoccurrence of the string fork . The -i flag makes the search case insensitve. 

34

Page 35: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 35/68

+More Commands

n  kill - sends a signal to a process or process group

n  You can only kill your own processes unless you are root 

UID PID PPID C STIME TTY TIME CMDroot 6715 6692 2 14:34 ttyp0 00:00:00 sleep 10h

root 6716 6692 0 14:34 ttyp0 00:00:00 ps -ef[root@penguinvm log]# kill 6715

[1]+ Terminated sleep 10h

35

Page 36: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 36/68

+More Commands

n  sed - applies a set of editing subcommands contained in ascript to each argument input file"

 find ./ -name "*.c,v" | sed s/,v//g | xargs grep "PATH"!This finds all files in the current and subsequent directories with an extension of c,v.sed then strips the ,v off the results of the find command. xargs then uses the resultsof sed and builds a grep command which searches for occurrences of the word PATH in

the C source files."

36

Page 37: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 37/68

+More Commands

n  tar - manipulates archives

n  An archive is a single file that contains the complete contents of aset of other files; an archive preserves the directory hierarchy thatcontained the original files. Similary to a VMARC file

tar -tzf imap-4.7.tar.gzimap-4.7/imap-4.7/src/imap-4.7/src/c-client/imap-4.7/src/c-client/env.himap-4.7/src/c-client/fs.h 

37

Page 38: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 38/68

+Switching Users

n su <accountname>  n switch user accounts. You will be prompted for a

password. When this command completes, you will belogged into the new account. Type exit to return to

the previous account

n su n Switch to the root user account. Do not do this lightly

Note: The root user does not need to enter a password when

switching users. It may become any user desired. This is part of the power of the root account.

38

Page 39: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 39/68

+Environment Variables

n  Environment variables are global settings that control thefunction of the shell and other Linux programs. They aresometimes referred to global shell variables.

n Setting:n  VAR=/home/fred/docn  export TERM=ansin  SYSTEMNAME=`uname -n`

n  Similar to GLOBALV SET … in CMS

39

Page 40: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 40/68

+Environment Variables

n  Using Environment Variables:

n echo $VARn cd $VARn cd $HOMEn echo You are running on$SYSTEMNAME 

n  Displaying - use the following commands:

n  set (displays local & env. Vars) 

n  exportn  Vars can be retrieved by a script or a program

40

Page 41: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 41/68

+Some Important Environment

Variables

n  HOME

n  Your home directory (often be abbreviated as ~)

n  TERM

n  The type of terminal you are running (for example vt100, xterm,and ansi)

n  PWD

n  Current working directory

n PATHn  List of directories to search for commands

41

Page 42: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 42/68

+PATH Environment Variable

n  Controls where commands are found

n  PATH is a list of directory pathnames separated by colons. Forexample:

PATH=/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/

home/scully/bin n  If a command does not contain a slash, the shell tries finding the

command in each directory in PATH. The first match is thecommand that will run

42

Page 43: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 43/68

+PATH Environment Variable

n  Similar to setting the CMS search order

n  Usually set in /etc/profile (like the SYSPROF EXEC)

n  Often modified in ~/.profile (like the PROFILE EXEC)

43

Page 44: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 44/68

+File Permissions

n  Every file

n  Is owned by someone

n  Belongs to a group

n  Has certain access permissions for owner, group, and others

n  Default permissions determined by umask 

44

Page 45: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 45/68

+File Permissions

n  Every user:

n  Has a uid (login name), gid (login group) and membership of a"groups" list:

n  The uid is who you are (name and number)

n  The gid is your initial login group you normally belong to

n  The groups list is the file groups you can access via group

permissions

45

Page 46: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 46/68

+File Permissions

n  Linux provides three kinds of permissions:

n  Read - users with read permission may read the file or list thedirectory

n  Write - users with write permission may write to the file or new files

to the directoryn  Execute - users with execute permission may execute the file or

lookup a specific file within a directory

46

Page 47: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 47/68

+File Permissions

n  The long version of a file listing (ls -l) will display the filepermissions:

-rwxrwxr-x 1 rvdheij rvdheij 5224 Dec 30 03:22 hello-rw-rw-r-- 1 rvdheij rvdheij 221 Dec 30 03:59 hello.c-rw-rw-r-- 1 rvdheij rvdheij 1514 Dec 30 03:59 hello.sdrwxrwxr-x 7 rvdheij rvdheij 1024 Dec 31 14:52 posixuft 

Permissions

 

Owner 

Group

47

Page 48: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 48/68

+Interpreting File Permissions

-rwxrwxrwx 

Other permissions

Group permissions

Owner permissions

Directory flag (d=directory; l=link) 

Page 49: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 49/68

+Changing File Permissions

n  Use the chmod command to change file permissions

n  The permissions are encoded as an octal number

chmod 755 file # Owner=rwx Group=r-x Other=r-xchmod 500 file2 # Owner=r-x Group=--- Other=---chmod 644 file3 # Owner=rw- Group=r-- Other=r--

chmod +x file # Add execute permission to file for allchmod o-r file # Remove read permission for otherschmod a+w file # Add write permission for everyone

49

Page 50: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 50/68

+Links?

n  Links are references to files (aliases)

n  Two forms:

n  Hard

n  Symbolic

n  Can point to files on different physical devices

n  Delete of original leaves link 

n  Delete of link leaves original

n  Can be created for directories

n  Create using ln command

Page 51: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 51/68

+Editors

n  People are fanatical about their editor

n  Several choices available:  

n  Vi: Standard UNIX editor

n  The: XEDIT-like editor

n  Xedit: X windows text editor

n  Emacs: Extensible, Customizable Self-Documenting DisplayEditor

n  Pico: Simple display-oriented text editor

n  Nedit: X windows Motif text editor

51

Page 52: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 52/68

+Linux Device Handling

n  Devices are the way linux talks to the world

n  Devices are special files in the /dev directory (try ls /dev)

/dev/ttyx  TTY devices/dev/hdb IDE hard drive

/dev/hdb1 Partition 1 on the IDE hard drive/dev/mnda VM Minidisk

/dev/dda Channel Attached DASD

/dev/dda1 Partition 1 on DASD

/dev/null The null device (hole

)

/dev/zero An endless stream of zeroes

/dev/mouse Link to mouse (not /390)

52

Page 53: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 53/68

+Devices and Drivers

n  Each /dev file has a major and minor number

n  Major defines the device type

n  Minor defines device within that type

n  Drivers register a device type

brw-r--r-- 1 root root 64, 0 Jun 1 1999 /dev/mnda

crw-r--r-- 1 root root 5, 0 Jan 5 09:18 /dev/tty 

Major no.  Minor no.Device Type:b - block c - character  

53

Page 54: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 54/68

+Special Files - /proc

n  Information about internal Linux processes are accessible tousers via the /proc file system (in memory)

/proc/cpuinfo CPU Information/proc/interrupts Interrupt usage

/proc/version Kernel version

/proc/modules Active modules

cat /proc/cpuinfovendor_id : IBM/S390

# processors : 1bogomips per cpu: 86.83processor 0: version = FF, identification = 045226, machine = 9672 

54

Page 55: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 55/68

+File Systems

n  Linux supports many different types

n  Most commonly, ext2fs

n  Filenames of 255 characters

n  File sizes up to 2GBn  Theoretical limit 4TB

n  Derived from extfs

n  Highly reliable and high performer

55

Page 56: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 56/68

+File Systems

n  Other file systems:

n  Sysv - SCO/Xenix

n  ufs - SunOS/BSD

n  vfat - Win9x

n  Msdos - MS-DOS/Win

n  Umsdos - Linux/DOS

n  ntfs - WinNT (r/o)

n  hpfs - OS/2 (r/o)

n  Other File systems:

n  iso9660 (CD-ROM)

n  Nfs - NFS

n  Coda - NFS-like

n  ncp - Novell

n  smb - LANManageretc

56

Page 57: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 57/68

+File Systems

n  mount 

n  Mounts a file system that lives on a device to the main file tree

n  Start at Root file system

n  Mount to root

n  Mount to points currently mounted to root

n  /etc/fstab used to establish boot time mounting

57

Page 58: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 58/68

+Processes

n  Processes are created in a hierarchical structure whose depth

is limited only by the virtual memory available to the virtual

machine

n  A process may control the execution of any of its descendants

by suspending or resuming it, altering its relative priority, or

even terminating it

n  Termination of a process by default causes termination of all

its descendants; termination of the root process causes

termination of the session

n  Linux assigns a process ID (PID) to the process

58

Page 59: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 59/68

+Processes

n  Foreground

n  When a command is executed from the prompt and runs to

completion at which time the prompt returns is said to run in the

foreground

n  Background

n  When a command is executed from the prompt with the token & 

at the end of the command line, the prompt immediately returns

while the command continues is said to run in the background

59

Page 60: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 60/68

+Processes

n  Daemons

n  Background processes for system administration are referred to asdaemons 

n  These processes are usually started during the boot process

n  The processes are not assigned any terminals

UID PID PPID C STIME TTY TIME CMD

root 5 1 0 1999 ? 00:00:14 [kswapd]

bin 254 1 0 1999 ? 00:00:00 [portmap]root 307 1 0 1999 ? 00:00:23 syslogd -m 0root 350 1 0 1999 ? 00:00:34 httpd 

60

Page 61: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 61/68

+Processes

[root@penguinvm log]# sleep 10h &

[1] 6718[root@penguinvm log]# ps -efUID PID PPID C STIME TTY TIME CMD

root 6718 6692 0 14:49 ttyp0 00:00:00 sleep 10h 

& causes process to be run

in background 

Job Number  Process ID (ID) Parent Process ID

61

Page 62: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 62/68

+Processes - UID & GID

n  Real UID 

n  At process creation, the real UID identifies the user who has createdthe process 

n  Real GID 

n  At process creation, the real GID identifies the current connectgroup of the user for which the process was created"

62

Page 63: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 63/68

+Processes - UID & GID

n  Effective UID

n  The effective UID is used to determine owner access privileges of a process.

n  Normally the same as the real UID. It is possible for a program tohave a special flag set that, when this program is executed,

changes the effective UID of the process to the UID of the owner of the program.

n  A program with this special flag set is said to be a set-user-IDprogram (SUID). This feature provides additional permissions tousers while the SUID program is being executed.

63

Page 64: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 64/68

+Processes - UID & GID

n  Effective GID

n  Each process also has an effective group

n  The effective GID is used to determine group access privileges of a process

n Normally the same as the real GID. A program can have a specialflag set that, when this program is executed, changes the effectiveGID of the process to the GID of the owner of this program

n  A program with this special flag set is said to be a set-group-IDprogram (SGID). Like the SUID feature, this provides additionalpermission to users while the set-group-ID program is beingexecuted

64

Page 65: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 65/68

+Processes - Process Groups

n  Each process belongs to a process group

n  A process group is a collection of one or more processes

n  Each process group has a unique process group ID

n  It is possible to send a signal to every process in the groupjust by sending the signal to the process group leader

n  Each time the shell creates a process to run an application,the process is placed into a new process group

n  When an application spawns new processes, these aremembers of the same process group as the parent

65

Page 66: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 66/68

+Processes - PID

n  PID

n  A process ID is a unique identifier assigned to a process while itruns

n  Each time you run a process, it has a different PID (it takes a longtime for a PID to be reused by the system)

n  You can use the PID to track the status of a process with the ps command or the jobs command, or to end a process with thekill command"

66

67

Page 67: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 67/68

+Processes - PGID

n  PGID

n  Each process in a process group shares a process group ID (PGID),which is the same as the PID of the first process in the process

group

n This ID is used for signaling-related processes

n  If a command starts just one process, its PID and PGID are the

same"

67

68

Page 68: 01_intro to linux

8/7/2019 01_intro to linux

http://slidepdf.com/reader/full/01intro-to-linux 68/68

+Processes - PPID

n  PPID

n  A process that creates a new process is called a parent process ; thenew process is called a child process 

n  The parent process (PPID) becomes associated with the new child

process when it is createdn  The PPID is not used for job control"

68