Home > Unix > UNIX – Lesson 024 – Job and Job Scheduling – ps and kill commands

UNIX – Lesson 024 – Job and Job Scheduling – ps and kill commands


In Unix, every program running on system is called process.

Each application can fork more than one process.

Each process has an identification number called :

  • PID (Process ID)

and the forking process ID is called

  • PPID (parent PID).

It is possible to run time consuming programs in background.

==================================================================================

ps

The “ps” command is used to get a list of process running

Syntax :
ps [options]

Key argument:

  • -e lists information about every process now running
  • -f generates a full listing
  • -u uidlist lists only process data whose effective user ID number or login
    name is given in “uidlist”. Normally used with “f”
    option

Example :
$ ps

PID TTY TIME COMMAND
12569 ttyp9 0:00 ps
12554 ttyp9 0:00 sh

$ ps –ef

UID PID PPID C STIME TTY TIME COMMAND
root 1 0 0 Sep 3 ? 0:54 init
root 2 0 0 Sep 3 ? 84:41 sh

$ ps –fu xarabas

UID PID PPID C STIME TTY TIME COMMAND
xarabas 1 0 0 Sep 3 ? 1:54 init
xarabas 2 0 0 Sep 3 ? 54:41 xclock

==================================================================================
kill
The “kill” command sends a terminate signal to a process

Syntax:
kill [-s signal_name [signal_number]] PID [PID …]

The kill table signal (usually used)

Signal Name Signal Number Description
HUP 1 Hang up signal
KILL 9 Kill (cannot be ignored)

Use the command
kill –l
to get a complete list of all signal

Example :
$kill 995 #by default kill send TERM signal

$kill –9 995 #send –KILL signal

Categories: Unix
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: