The words you are searching are inside this book. To get more targeted content, please make full-text search by clicking here.
Discover the best professional documents and content resources in AnyFlip Document Base.
Search
Published by vikasm.dtu, 2015-04-16 08:06:55

Tutorial6

Tutorial6

Tutorial #6

Investigating and Managing Processes

What is a Process?
●A process is a set of instructions loaded into memory
❍Numeric Process ID (PID) used for identification
❍UID, GID and SELinux context determines filesystem access
■Normally inherited from the executing user
Listing Processes
●View Process information with ps
❍Shows processes from the current terminal by default
❍-a includes processes on all terminals
❍-x includes processes not attached to terminals
❍-u prints process owner information
❍-f prints process parentage
❍-o PROPERTY, prints custom information:
■ pid, comm, %cpu, %mem, state, tty, euser, ruser

Finding Processes

●Most flexible: ps options| other commands
ps axo comm,tty | grep ttyS0
●By predefined patterns: pgrep
$ pgrep -U root
$ pgrep -G student
●By exact program name: pidof
$ pidof bash

Signals

●Most fundamental inter-process communication
❍Sent directly to processes, no user-interface required

❍Programs associate actions with each signal
❍Signals are specified by name or number when sent:
■Signal 15, TERM (default) - Terminate cleanly
■Signal 9, KILL - Terminate immediately
■Signal 1, HUP - Re-read configuration files
■man 7 signal shows complete list

Sending Signals to Processes

●By PID: kill [signal] pid
●By Name: killall [signal] comm
●By pattern: pkill [-signal] pattern

Interactive Process Management Tools

●CLI: top
●GUI: gnome-system-monitor
●Capabilities
❍Display real-time process information
❍Allow sorting, killing and re-nicing

Job Control

●Run a process in the background
❍Append an ampersand to the command line: firefox &
●Temporarily halt a running program
❍Use Ctrl-z or send signal 17 (STOP)
●Manage background or suspended jobs
❍List job numbers and names: jobs
❍Resume in the background: bg [%jobnum]
❍Resume in the foreground: fg [%jobnum]
❍Send a signal: kill [-SIGNAL] [%jobnum]


Click to View FlipBook Version