Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 
 

Get Process Status ps command

Linux Tips by Burleson Consulting

Process and Service Management

When any command is run on the Linux system, a resulting process is created to carry out the requested work for that command.  Some commands start and complete so quickly they seem instant, others may start when the system is booted and run until it shuts down.

Services are processes, often started when the system starts up, that run in the background in order to provide some additional functionality.  These are often called daemons (pronounced like demon) and provide facilities such as SSH, email and automatic mounting of disks.

Examining Running Processes

The first step to managing processes is being able to identify what processes are running.  Even if the system has just been started up and nothing else, there will be dozens of processes running.  These are mostly daemons started from the init scripts at system startup.  Daemons will be covered in further detail later in this chapter.

Several attributes are tracked for each process running on the system.  When it is started, each process receives a process number to uniquely identify it on the system.  The owner and the process number of the process that starts it (the parent process) is are also tracked as well as the start time.

The ps commandis used to report the processes currently running on the system.  If no options are given, ps reports minimal information on processes owned by the current user.  To get more information, the -e and -f options may be used. The -e option requests every process and the -f option is for full information on processes listed.  These may be combined as '??ef, causing all running processes to be reported in a long output format.

$ ps -ef

UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 06:45 ?        00:00:12 init [3] 
root         2     1  0 06:45 ?        00:00:00 [migration/0]
root         3     1  0 06:45 ?        00:00:00 [ksoftirqd/0]
...
oracle    2718  2716  0 06:50 ?        00:00:00 sshd: oracle@pts/0
oracle    2719  2718  0 06:50 pts/0    00:00:00 -bash
root      2897  2361  0 07:14 ?        00:00:00 sshd: oracle [priv]

oracle    2899  2897  0 07:14 ?        00:00:00 sshd: oracle@pts/1
oracle    2900  2899  0 07:14 pts/1    00:00:00 -bash
oracle    2967  2900  0 07:20 pts/1    00:00:00 ps -ef


All running processes are reported, from the init process which is the first process started on the system right up to the ps command you are running to report the running processes.  There can easily be hundreds or thousands of processes running on a system, so you will typically want to restrict which processes you see.

Each line of the ps output represents a currently running process.  With the -f option, the following attributes are displayed:

Column label Value
UID The owner of this process
PID The unique process ID for this process
PPID The process ID of the parent to this process (the process that started this process)
C The percentage of CPU time used by this process since it was started
STIME The time (and date if before today) that this process was started

TTY

The terminal associated with this process (if any)

TIME

The total time this process has spent being processed

CMD

The command and arguments executed

Table 10.1:  Attributes with the '??f option

There are several options to change the output format of the ps command, but for most purposes, the standard -f output is sufficient.

WARNING: Commands and arguments can be viewed by any user on the system, so it is important not to reveal any passwords or other sensitive information in command names or arguments.

One way to restrict the output of the ps command is to use the -u option which causes ps to report on a specific user's processes. It is shown here with the -f option to give additional information about each process.

$ ps -fu oracle

UID        PID  PPID  C STIME TTY          TIME CMD
oracle    2718  2716  0 06:50 ?        00:00:00 sshd: oracle@pts/0
oracle    2719  2718  0 06:50 pts/0    00:00:00 -bash
oracle    2899  2897  0 07:14 ?        00:00:00 sshd: oracle@pts/1
oracle    2900  2899  0 07:14 pts/1    00:00:00 -bash
oracle    3079  2900  0 07:40 pts/1    00:00:00 -bash

oracle    3122  3079  0 07:40 pts/1    00:00:00 -bash
oracle    3172  3122  0 07:40 pts/1    00:00:00 sqlplus      

oracle    3179     1  0 07:41 ?        00:00:00 ora_pmon_TEST
oracle    3181     1  1 07:41 ?        00:00:00 ora_vktm_TEST
oracle    3185     1  0 07:41 ?        00:00:00 ora_diag_TEST
oracle    3187     1  0 07:41 ?        00:00:00 ora_dbrm_TEST
oracle    3189     1  0 07:41 ?        00:00:00 ora_psp0_TEST
oracle    3193     1  0 07:41 ?        00:00:00 ora_dia0_TEST
oracle    3195     1  1 07:41 ?        00:00:00 ora_mman_TEST
oracle    3197     1  0 07:41 ?        00:00:00 ora_dbw0_TEST
oracle    3201     1  0 07:41 ?        00:00:00 ora_lgwr_TEST
oracle    3203     1  0 07:41 ?        00:00:00 ora_ckpt_TEST
oracle    3205     1  1 07:41 ?        00:00:00 ora_smon_TEST
oracle    3207     1  0 07:41 ?        00:00:00 ora_reco_TEST
oracle    3209     1  2 07:41 ?        00:00:00 ora_mmon_TEST
oracle    3211     1  0 07:41 ?        00:00:00 ora_mmnl_TEST
oracle    3213     1  0 07:41 ?        00:00:00 ora_d000_TEST
oracle    3215     1  0 07:41 ?        00:00:00 ora_s000_TEST
oracle    3222  3172 11 07:41 ?        00:00:01 oracleTEST
(DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
oracle    3224     1  1 07:41 ?        00:00:00 ora_fbda_TEST
oracle    3226     1  0 07:41 ?        00:00:00 ora_smco_TEST
oracle    3228     1  1 07:41 ?        00:00:00 ora_qmnc_TEST
oracle    3230     1  1 07:41 ?        00:00:00 ora_w000_TEST
oracle    3234  2719  0 07:41 pts/0    00:00:00 ps -fu oracle

To view the current processes (running programs) active within the system, the process status (ps) command can be used. The ps command accepts a large number of options; however, the most useful ones are the show all (?e) option and the show full (?f) option, which can be entered as follows:

$ ps ?ef

UID        PID  PPID  C STIME TTY          TIME CMD
terry     3696 18588  0 18:10 ?        00:00:01 gnome-session
terry     4054     1  0 18:10 ?        00:00:01 /usr/lib/gconfd-2 11
terry    25812     1  0 18:10 ?        00:00:00 /usr/lib/bonobo-activation-serve
terry    11467     1  0 18:10 ?        00:00:00 gnome-smproxy --sm-client-id def
terry    13021     1  0 18:10 ?        00:00:00 gnome-settings-daemon --oaf-acti
terry     1519     1  0 18:10 ?        00:00:00 xscreensaver -nosplash
terry     4029     1  0 18:10 ?        00:00:11 /usr/bin/metacity --sm-client-id
terry    21462     1  0 18:10 ?        00:00:11 gnome-panel --sm-client-id defau
terry     2216 25609  0 18:10 ?        00:00:00 nautilus --no-default-window --s
terry    18785     1  0 18:10 ?        00:00:00 /usr/lib/notification-area-apple
terry    30999     1  0 18:10 ?        00:00:00 pam-panel-icon --sm-client-id de
terry     8494     1  0 18:55 ?        00:00:13 kwrite
terry     4890     1  0 18:55 ?        00:00:00 kdeinit: Running...
terry    16796     1  0 18:55 ?        00:00:00 kdeinit: dcopserver --nosid --su
terry    29590     1  0 18:55 ?        00:00:00 kdeinit: klauncher
terry     6513     1  0 18:55 ?        00:00:01 kdeinit: kded
terry    23583  4890  0 20:37 ?        00:00:00 kdeinit: kio_file file /tmp/ksoc
terry    21234     1 21 20:55 ?        00:00:01 /usr/bin/gnome-terminal
terry    17263 21234  0 20:55 ?        00:00:00 [gnome-pty-helpe]
terry    14241 21234  2 20:55 pts/0    00:00:00 bash
terry    18504 14241  0 20:55 pts/0    00:00:00 ps ?ef
...

The command ps ?ef will output lots of information about all the running commands on the system.  Here's a quick explanation of what this output means:

Column

Description

UID

Username of the process owner

PID

Process ID number of this process

PPID

Process ID of the process which started this one (parent)

C

CPU utilization of this process

STIME

Start time (listed as month and day if older than 1 day)

TTY

The terminal (if any) the process was started from

TIME

The amount of CPU time this process has consumed

CMD

The command which was executed (long commands are truncated)

To see how processes are related in a hierarchical structured display, the H option can be added to the command as shown below:

$ s ?efH

UID        PID  PPID  C STIME TTY          TIME CMD
terry     3696 18588  0 18:10 ?        00:00:01 gnome-session
terry    21234     1  1 20:55 ?        00:00:08 /usr/bin/gnome-terminal
terry    17263 21234  0 20:55 ?        00:00:00   [gnome-pty-helpe]
terry    14241 21234  0 20:55 pts/0    00:00:00   bash
terry     4786 14241  0 21:05 pts/0    00:00:00     ps -efH
terry    31992 25609  0 18:10 ?        00:00:00     nautilus --no-default-window --sm-lien
terry    11456 25609  0 18:10 ?        00:00:01     nautilus --no-default-window --sm-clien
terry     2216 25609  0 18:10 ?        00:00:00     nautilus --no-default-window --sm-clien
terry    21462     1  0 18:10 ?        00:00:11 gnome-panel --sm-client-id default2
terry     4029     1  0 18:10 ?        00:00:14 /usr/bin/metacity --sm-client-id=default1
terry    13021     1  0 18:10 ?        00:00:00 gnome-settings-daemon --oaf-activate-iid=OA
terry    11467     1  0 18:10 ?        00:00:00 gnome-smproxy --sm-client-id default0
terry    25812     1  0 18:10 ?        00:00:00 /usr/lib/bonobo-activation-server --ac-acti
terry     4054     1  0 18:10 ?        00:00:01 /usr/lib/gconfd-2 11

This format makes it easy to track which processes created which by listing child processes directly below their parent and indenting the CMD output two spaces for child processes.  In this example we see that process 21234 created two child processes, 17263 and 14241.  It is easy to identify these as sibling processes as they are indented the same amount and both follow the same parent process.  A quick check of the PPID confirms this.

In these examples we have been using the ps command to displays processes owned by all users with the ?e option.  This is often more than we need so we can instead use the ?u option to show processes owned by a specific user.  The following display is for the lp user:

$ ps -u lp

  PID TTY          TIME CMD
22233 ?        00:00:07 foomatic-rip
28688 ?        00:00:00 foomatic-rip
30970 ?        00:00:00 foomatic-rip
 7593 ?        00:00:00 sh
10833 ?        00:00:00 sh
 2005 ?        00:00:00 perl
32267 ?        00:00:03 gs
26226 ?        00:00:00 sh
 6930 ?        00:00:00 cat

Next we'll take a look at some other commands to gather information about running processes.


This is an excerpt from "Easy Linux Commands" by Linux guru Jon Emmons.  You can purchase it for only $19.95 (30%-off) at this link.


 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational