Customizing ps command

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Customizing ps command
# 1  
Old 03-28-2014
[Solved] Customizing ps command

I want to monitor our batch jobs at a specific interval for later analysis to see the performance and CPU utilization
 ps aux|grep dsadm|head
xxxxx   386  0.0  0.0 103524 15448 pts/0    S    Mar27   0:00 /etrade/home/dsadm/sqllib/bin/db2bp 28075A14861 5 A
dsadm     1339  0.0  0.0  24780  1696 ?        Ss   Mar13   0:00 dscs 4 0 0
dsadm     1351  0.0  0.0 158212 37128 ?        Ss   Mar13   0:00 dsapi_slave 7 6 0
xxxxxx  1911  0.0  0.0 103780 15800 pts/5    S    13:04   0:00 /etrade/home/dsadm/sqllib/bin/db2bp 24828A14861 5 A
dsadm     2721  0.0  0.0  24804  1752 ?        Ss   Mar19   0:00 dscs 4 0 0
dsadm     2722  0.0  0.0 158548 38036 ?        Ss   Mar19   0:02 dsapi_slave 7 6 0
dsadm     7298  0.0  0.0  11848  3520 ?        S    Mar23   0:08 /bin/ksh /etrade/prd/dsadm/batch/uscrm/prod/run//DCM/dcm_canary.ksh -project_code DCM -exec_mode PROD -run_date 20140316 -process_name DW_DCM_LOAD -hbinterval 5 -jobname DWDCM01LD
dsadm     7332  0.0  0.0  10924  2556 ?        S    Mar23   0:02 /bin/ksh /etrade/prd/dsadm/batch/uscrm/prod/run/DCM/dcm_load.ksh -project_code DCM -exec_mode PROD -run_date 20140316 -process_name DW_DCM_LOAD -hbinterval 5 -jobname DWDCM01LD
dsadm    10724  0.0  0.0  24780  1688 ?        Ss   Mar13   0:00 dscs 4 0 0
dsadm    10725  0.0  0.0 158924 38284 ?        Ss   Mar13   0:25 dsapi_slave 7 6 0

From which i can later identify the CPU and memory utilization etc.
But couldnt figure out a way to print the parent id in this output

ps -eo command,user,pid,ppid

i have this command to get the parent id also. but here i cant display the any of the performance parameter's. Is there a way to print both PID hierarchy and various performance factors for each process

Last edited by ratheeshjulk; 03-28-2014 at 03:31 PM.. Reason: few userid masked
# 2  
Old 03-28-2014
What is your OS and version?
# 3  
Old 03-28-2014
 uname -a
Linux XXXXXXXXX 2.6.18-308.4.1.el5 #1 SMP Wed Mar 28 01:54:56 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux

# 4  
Old 03-28-2014
ps -eo cmd,user,pid,ppid,pcpu,pmem,vsz,rss,start,stat

This User Gave Thanks to shamrock For This Post:
# 5  
Old 03-28-2014
ps axo user,pid,ppid,pcpu,%mem,vsz,rss,tt,stat,start,time,command

This User Gave Thanks to Scrutinizer For This Post:
# 6  
Old 03-28-2014
Originally Posted by shamrock
ps -eo cmd,user,pid,ppid,pcpu,pmem,vsz,rss,start,stat

Thanks a ton
Thats what i was looking for..
Just needed a small modification to display the entire command
ps -eo cmd:200,user,pid,ppid,pcpu,pmem,vsz,rss,start,stat

These 2 Users Gave Thanks to ratheeshjulk For This Post:
# 7  
Old 03-31-2014
Can i Give a separator between the fields in ps command itself
 ps -eo user,pid,ppid,pcpu,pmem,vsz,rss,start,stat,cmd|grep DW_DCM|head
rjanardh  3866  7777  0.0  0.0   6068   604 16:47:17 S+   grep DW_DCM
dsadm    28644 27590  0.0  0.0  10700  2356 21:00:06 S    /bin/ksh /etrade/prd/dsadm/batch/uscrm/prod/run//DCM/dcm_canary.ksh -project_code DCM -exec_mode PROD -run_date 20140330 -process_name DW_DCM_LOAD -hbinterval 5 -jobname DWDCM01LD
dsadm    28667 28644  0.0  0.0  10668  2172 21:00:06 S    /bin/ksh /etrade/prd/dsadm/batch/uscrm/prod/run/DCM/dcm_load.ksh -project_code DCM -exec_mode PROD -run_date 20140330 -process_name DW_DCM_LOAD -hbinterval 5 -jobname DWDCM01LD

I tried using awk command but if the 'command field' has space then output is weird.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Customizing bash on AIX

AIX is really different from most distros I am used to. I am trying to set up my .bashrc so I did this in the file. I noticed when I ssh into the server or use the bash command for a new shell it was being ignored. #------------------------------------------------------------- # Source global... (2 Replies)
Discussion started by: cokedude
2 Replies

2. Red Hat

RHEL6 customizing prompt do not work

Hi, I'm trying to customize the ksh prompt for users on a RHEL 6.6 system for having user@host pwd : $ and user@host pwd # in red color for root. I think it's possible but i do not even succeded for a non root user : I added in my ~/.kshrc : PS1="Hello : " and it works but when i... (4 Replies)
Discussion started by: Fundix
4 Replies

3. UNIX for Dummies Questions & Answers

customizing default file permission

By default, the files are creates with this permissions:-rw-rw-r-- Is it possible to customize that in such away that ,always created as 777. Where i need to make changes? Please guide me. Thanks (2 Replies)
Discussion started by: pandeesh
2 Replies

4. UNIX for Dummies Questions & Answers

Customizing from address in mailx command

Currently I am using mailx command for sending mails. But the mail is sent as from userid@servername by default. Is it possible to customise the from mail address in mailx command? Thanks (2 Replies)
Discussion started by: pandeesh
2 Replies

5. UNIX for Dummies Questions & Answers

Customizing UNIX

Hello i'm just wondering how to customize the color of unix's (or SSH) background, cursor, and letter? Thank you for your time (4 Replies)
Discussion started by: mgyeah
4 Replies

6. Red Hat

Customizing RHEL OS

Hello Every One, I am not sure if this is the correct forum to post this question. But please help me with your ideas. I have got a work (proj) where i need to customize the RHEL OS . This would involve building packages, installing them , correcting privileges etc and all these... (4 Replies)
Discussion started by: shirsha
4 Replies

7. Shell Programming and Scripting

customizing desktop

I need help editing my openwin file. I've got it all set up so the options I normally use (xman, cmdtools, xeyes, printtool) automatically come up when I log on, but it won't read my -geometry entries. I got them by right-clicking on the desktop, but apparently they need to be entered a certain... (0 Replies)
Discussion started by: sdienlin
0 Replies

8. UNIX for Dummies Questions & Answers

Customizing CDE background

i have a question about setting the background in a workspace in CDE. I have CDE runnning on Solaris 8 here at work and I want to use some images I have as the background in or two of the workspaces. When I use xv on the image and choose the option the option from the Display Menu -> Root:... (1 Reply)
Discussion started by: Kanu77
1 Replies

9. UNIX for Dummies Questions & Answers

customizing xterm windows

Does anyone now how to customize an xterm window in solaris to dynamically 'pwd' in the banner. I know how to launch with xterm -n 'cwd' but it does not change when I change dir's. (4 Replies)
Discussion started by: toddy44
4 Replies
Login or Register to Ask a Question