ps results - to show user's ps only


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers ps results - to show user's ps only
# 1  
Old 10-12-2007
Question [SOLVED] ps results - to show user's ps only

hi!

how do i make ps results to only shows what's owned by users current job/background process only

currently when users issuing ps:
Quote:
[psycho@server /usr/bin]$ ps aux
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
root 10 98.9 0.0 0 8 ?? RL Mon03AM 6412:30.63 [idle]
root 37 0.0 0.0 0 8 ?? DL Mon03AM 5:55.64 [syncer]
root 0 0.0 0.0 0 0 ?? WLs Mon03AM 0:00.00 [swapper]
root 1 0.0 0.0 768 248 ?? ILs Mon03AM 0:07.87 /sbin/init --
root 2 0.0 0.0 0 8 ?? DL Mon03AM 0:09.68 [g_event]
root 3 0.0 0.0 0 8 ?? DL Mon03AM 0:16.85 [g_up]
root 4 0.0 0.0 0 8 ?? DL Mon03AM 0:21.84 [g_down]
root 5 0.0 0.0 0 8 ?? DL Mon03AM 0:00.00 [xpt_thrd]
root 6 0.0 0.0 0 8 ?? DL Mon03AM 0:00.00 [kqueue taskq]
root 7 0.0 0.0 0 8 ?? DL Mon03AM 0:00.00 [thread taskq]
root 8 0.0 0.0 0 8 ?? DL Mon03AM 0:03.53 [fdc0]
root 9 0.0 0.0 0 8 ?? DL Mon03AM 0:00.28 [pagedaemon]
root 11 0.0 0.0 0 8 ?? WL Mon03AM 6:25.82 [swi4: clock sio]
root 12 0.0 0.0 0 8 ?? WL Mon03AM 0:00.00 [swi3: vm]
root 13 0.0 0.0 0 8 ?? WL Mon03AM 0:44.71 [swi1: net]
root 14 0.0 0.0 0 8 ?? DL Mon03AM 0:15.03 [yarrow]
root 15 0.0 0.0 0 8 ?? WL Mon03AM 0:00.00 [swi5: +]
root 16 0.0 0.0 0 8 ?? WL Mon03AM 0:00.00 [swi2: cambio]
root 17 0.0 0.0 0 8 ?? WL Mon03AM 0:00.00 [swi6: task queue]
root 18 0.0 0.0 0 8 ?? WL Mon03AM 0:00.00 [swi6: Giant taskq]
root 19 0.0 0.0 0 8 ?? WL Mon03AM 0:58.61 [irq23: bge0 uhci0+]
root 20 0.0 0.0 0 8 ?? DL Mon03AM 0:00.02 [usb0]
root 21 0.0 0.0 0 8 ?? DL Mon03AM 0:00.00 [usbtask]
root 22 0.0 0.0 0 8 ?? WL Mon03AM 0:18.71 [irq19: uhci1+]
root 23 0.0 0.0 0 8 ?? DL Mon03AM 0:00.01 [usb1]
root 24 0.0 0.0 0 8 ?? WL Mon03AM 0:00.00 [irq18: uhci2]
root 25 0.0 0.0 0 8 ?? DL Mon03AM 0:00.01 [usb2]
root 26 0.0 0.0 0 8 ?? WL Mon03AM 0:00.00 [irq16: uhci3]
root 27 0.0 0.0 0 8 ?? DL Mon03AM 0:00.01 [usb3]
root 28 0.0 0.0 0 8 ?? DL Mon03AM 0:00.01 [usb4]
root 29 0.0 0.0 0 8 ?? WL Mon03AM 0:00.00 [irq14: ata0]
root 30 0.0 0.0 0 8 ?? WL Mon03AM 0:00.00 [irq15: ata1]
root 31 0.0 0.0 0 8 ?? WL Mon03AM 0:00.00 [irq1: atkbd0]
root 32 0.0 0.0 0 8 ?? WL Mon03AM 0:00.00 [irq7: ppc0]
root 33 0.0 0.0 0 8 ?? WL Mon03AM 0:00.00 [swi0: sio]
root 34 0.0 0.0 0 8 ?? DL Mon03AM 0:00.00 [vmdaemon]
root 35 0.0 0.0 0 8 ?? DL Mon03AM 0:23.42 [pagezero]
root 36 0.0 0.0 0 8 ?? DL Mon03AM 0:01.31 [bufdaemon]
root 38 0.0 0.0 0 8 ?? DL Mon03AM 0:01.69 [vnlru]
root 39 0.0 0.0 0 8 ?? DL Mon03AM 0:01.58 [softdepflush]
root 40 0.0 0.0 0 8 ?? DL Mon03AM 0:19.04 [schedcpu]
root 485 0.0 0.0 528 284 ?? Is Mon03AM 0:00.00 /sbin/devd
root 545 0.0 0.1 1404 948 ?? Ss Mon03AM 0:20.95 /usr/sbin/syslogd -l /var/run/log -l /var/na
root 715 0.0 0.1 1296 732 ?? Ss Mon03AM 0:00.35 /usr/sbin/usbd
root 724 0.0 0.2 2752 1812 ?? Is Mon03AM 1:57.41 /usr/sbin/sshd
root 729 0.0 0.6 7648 6064 ?? Ss Mon03AM 0:04.70 /usr/bin/perl /root/webmin-1.370/miniserv.pl
root 823 0.0 0.1 1432 1000 ?? Is Mon03AM 0:01.37 /usr/sbin/cron -s
root 875 0.0 0.6 7772 6112 ?? Ss Mon03AM 0:08.05 /usr/local/apache/bin/httpd -DSSL
mailnull 879 0.0 0.2 5752 2212 ?? Is Mon03AM 0:00.43 /usr/sbin/sendmail -bd -q30m (exim-4.66-0)
mailnull 882 0.0 0.2 5752 2208 ?? Is Mon03AM 0:00.00 /usr/sbin/sendmail -tls-on-connect -bd -oX 4
root 935 0.0 2.5 26776 25848 ?? Ss Mon03AM 0:50.19 /usr/bin/spamd -d --allowed-ips=127.0.0.1 --
root 966 0.0 2.5 27092 26136 ?? I Mon03AM 0:01.43 spamd child (perl)
root 967 0.0 2.5 27116 26152 ?? I Mon03AM 0:00.54 spamd child (perl)
mailman 1039 0.0 0.7 9332 7428 ?? Is Mon03AM 0:00.01 /usr/local/bin/python2.4 /usr/local/cpanel/3
mailman 1042 0.0 0.7 9268 7316 ?? S Mon03AM 0:47.17 /usr/local/bin/python2.4 /usr/local/cpanel/3
mailman 1043 0.0 0.7 9272 7324 ?? S Mon03AM 0:42.22 /usr/local/bin/python2.4 /usr/local/cpanel/3
mailman 1044 0.0 0.7 9272 7328 ?? S Mon03AM 0:40.10 /usr/local/bin/python2.4 /usr/local/cpanel/3
mailman 1045 0.0 0.7 9268 7324 ?? S Mon03AM 0:41.94 /usr/local/bin/python2.4 /usr/local/cpanel/3
mailman 1046 0.0 0.7 9284 7360 ?? S Mon03AM 0:39.21 /usr/local/bin/python2.4 /usr/local/cpanel/3
mailman 1047 0.0 0.7 9324 7408 ?? S Mon03AM 0:44.93 /usr/local/bin/python2.4 /usr/local/cpanel/3
mailman 1048 0.0 0.7 9268 7320 ?? S Mon03AM 0:40.31 /usr/local/bin/python2.4 /usr/local/cpanel/3
mailman 1050 0.0 0.7 9268 7320 ?? I Mon03AM 0:00.21 /usr/local/bin/python2.4 /usr/local/cpanel/3
root 1061 0.0 0.7 7820 7000 ?? Is Mon03AM 0:00.00 cPhulkd - processor (perl5.8.8)
mysql 1153 0.0 2.7 59948 28244 ?? S Mon03AM 1:39.72 /usr/local/libexec/mysqld --basedir=/usr/loc
root 2052 0.0 0.2 2468 1828 ?? Is Mon03AM 0:01.91 proftpd: (accepting connections) (proftpd)
root 6903 0.0 0.4 6544 4052 ?? I Mon09AM 0:00.28 /usr/local/ispmgr/bin/ispmgr
root 13472 0.0 0.2 5380 2048 ?? Is 6:01PM 0:00.04 sshd: coder [priv] (sshd)
coder 13474 0.0 0.2 5364 2104 ?? S 6:01PM 0:00.02 sshd: coder@ttyp0 (sshd)
root 26904 0.0 0.4 5056 4376 ?? I Wed05AM 0:00.12 /usr/local/etc/authlib/authProg (courier-aut
nobody 27444 0.0 0.9 11320 9680 ?? I 9:43PM 0:00.50 /usr/local/apache/bin/httpd -DSSL
nobody 27445 0.0 0.9 11240 9604 ?? I 9:43PM 0:00.51 /usr/local/apache/bin/httpd -DSSL
nobody 27446 0.0 1.0 11512 9872 ?? I 9:43PM 0:00.44 /usr/local/apache/bin/httpd -DSSL
nobody 27447 0.0 1.0 11476 9836 ?? I 9:43PM 0:00.51 /usr/local/apache/bin/httpd -DSSL
nobody 27448 0.0 0.9 10552 8864 ?? I 9:43PM 0:00.32 /usr/local/apache/bin/httpd -DSSL
bind 27541 0.0 0.3 4796 3420 ?? Is 9:44PM 0:00.34 /usr/local/sbin/named -u bind -c /etc/namedb
nobody 27549 0.0 0.9 11420 9780 ?? I 9:44PM 0:00.70 /usr/local/apache/bin/httpd -DSSL
nobody 27693 0.0 0.9 11384 9748 ?? I 10:05PM 0:00.73 /usr/local/apache/bin/httpd -DSSL
nobody 28100 0.0 0.9 11268 9632 ?? I 11:13PM 0:00.62 /usr/local/apache/bin/httpd -DSSL
nobody 28120 0.0 0.9 11424 9780 ?? I 11:18PM 0:00.20 /usr/local/apache/bin/httpd -DSSL
nobody 28121 0.0 0.9 11380 9744 ?? I 11:18PM 0:00.51 /usr/local/apache/bin/httpd -DSSL
root 44871 0.0 0.4 5056 4376 ?? I Wed06AM 0:00.13 /usr/local/etc/authlib/authProg (courier-aut
root 45135 0.0 0.4 5056 4376 ?? I Wed06AM 0:00.12 /usr/local/etc/authlib/authProg (courier-aut
root 45229 0.0 0.4 5056 4376 ?? I Wed06AM 0:00.12 /usr/local/etc/authlib/authProg (courier-aut
root 61547 0.0 0.4 5052 4368 ?? I Tue05PM 0:00.16 /usr/local/etc/authlib/authProg (courier-aut
root 92678 0.0 1.8 19188 18456 ?? I 12:56PM 0:00.15 cpsrvd - waiting for connections (cpsrvd-ssl
root 1141 0.0 0.1 1352 816 v0 Is+ Mon03AM 0:00.00 /usr/libexec/getty Pc ttyv0
root 1142 0.0 0.1 1352 816 v1 Is+ Mon03AM 0:00.00 /usr/libexec/getty Pc ttyv1
root 1143 0.0 0.1 1352 816 v2 Is+ Mon03AM 0:00.00 /usr/libexec/getty Pc ttyv2
root 1144 0.0 0.1 1352 816 v3 Is+ Mon03AM 0:00.00 /usr/libexec/getty Pc ttyv3
root 1145 0.0 0.1 1352 816 v4 Is+ Mon03AM 0:00.00 /usr/libexec/getty Pc ttyv4
root 1146 0.0 0.1 1352 816 v5 Is+ Mon03AM 0:00.00 /usr/libexec/getty Pc ttyv5
root 1147 0.0 0.1 1352 816 v6 Is+ Mon03AM 0:00.00 /usr/libexec/getty Pc ttyv6
root 1148 0.0 0.1 1352 816 v7 Is+ Mon03AM 0:00.00 /usr/libexec/getty Pc ttyv7
root 743 0.0 0.1 1280 660 con- I Mon03AM 0:00.00 /usr/local/sbin/courierlogger -facility=mail
root 744 0.0 0.1 1488 848 con- I Mon03AM 0:00.02 /usr/local/libexec/courier-authlib/authdaemo
root 754 0.0 0.1 1280 632 con- I Mon03AM 0:00.01 /usr/local/sbin/courierlogger -pid=/var/run/
root 755 0.0 0.1 1360 840 con- I Mon03AM 0:00.01 /usr/local/libexec/courier-imap/couriertcpd
root 763 0.0 0.1 1276 616 con- I Mon03AM 0:00.00 [courierlogger]
root 764 0.0 0.1 1360 808 con- I Mon03AM 0:00.00 /usr/local/libexec/courier-imap/couriertcpd
root 770 0.0 0.1 1488 884 con- I Mon03AM 0:00.02 /usr/local/libexec/courier-authlib/authdaemo
root 771 0.0 0.1 1488 884 con- I Mon03AM 0:00.02 /usr/local/libexec/courier-authlib/authdaemo
root 772 0.0 0.1 1488 884 con- I Mon03AM 0:00.02 /usr/local/libexec/courier-authlib/authdaemo
root 773 0.0 0.1 1488 884 con- I Mon03AM 0:00.02 /usr/local/libexec/courier-authlib/authdaemo
root 774 0.0 0.1 1488 884 con- I Mon03AM 0:00.02 /usr/local/libexec/courier-authlib/authdaemo
root 778 0.0 0.1 1280 636 con- I Mon03AM 0:00.01 /usr/local/sbin/courierlogger -pid=/var/run/
root 779 0.0 0.1 1360 860 con- I Mon03AM 0:00.02 /usr/local/libexec/courier-imap/couriertcpd
root 788 0.0 0.1 1276 616 con- I Mon03AM 0:00.00 [courierlogger]
root 789 0.0 0.1 1360 808 con- I Mon03AM 0:00.00 /usr/local/libexec/courier-imap/couriertcpd
root 794 0.0 0.6 6336 5740 con- I Mon03AM 0:03.77 chkservd (perl5.8.8)
root 890 0.0 0.3 3516 2920 con- S Mon03AM 0:19.80 antirelayd (perl5.8.8)
root 1009 0.0 0.7 8440 7508 con- IN Mon03AM 0:00.08 cpanellogd - setting up logs for official (p
nobody 1054 0.0 0.3 3572 3024 con- I Mon03AM 0:00.00 entropychat (perl5.8.8)
official 1080 0.0 0.7 8444 7524 con- IN Mon03AM 0:00.00 cpanellogd - http logs for official (perl5.8
official 1082 0.0 0.0 944 384 con- TN Mon03AM 0:00.00 /usr/local/cpanel/bin/logrunner 1.0 /usr/loc
root 1083 0.0 1.0 14428 10796 con- I Mon03AM 0:00.00 cpdavd - accepting connections on 2077 and 2
root 1089 0.0 0.1 1744 1068 con- I Mon03AM 0:00.01 /bin/sh /usr/local/bin/mysqld_safe --user=my
coder 13475 0.0 0.2 3204 1956 p0 Ss 6:01PM 0:00.01 -bash (bash)
coder 13528 0.0 0.2 2452 1560 p0 T 6:10PM 0:00.08 top
coder 13542 0.0 0.1 1528 940 p0 R+ 6:11PM 0:00.00 ps aux
psycho 1527 0.0 0.3 3812 2864 p1- S Mon03AM 1:13.53 ./script
coder 50148 0.0 0.3 3324 2840 p1- S 3:22AM 0:05.26 ./codes2
[psycho@server /usr/bin]$
I just wanted the result when the user is issuing ps aux is same as when they're doing ps x like this:
Quote:
[psycho@server /usr/bin]$ ps x
PID TT STAT TIME COMMAND
13474 ?? S 0:00.02 sshd: coder@ttyp0 (sshd)
13475 p0 Ss 0:00.01 -bash (bash)
13528 p0 T 0:00.08 top
13565 p0 R+ 0:00.00 ps x
1527 p1- S 1:13.53 ./script
[psycho@server /usr/bin]$
(which shows result on user's current background process only)

thanks for helping

Last edited by rdns; 10-15-2007 at 01:41 PM..
# 2  
Old 10-12-2007
come on anyone know how can i make this possible
# 3  
Old 10-12-2007
if you tried reading the man page for ps instead of bumping your own posts you might find the answer!

Code:
ps -U username u

# 4  
Old 10-12-2007
i wonder if i put my question clear

i need to restrict the ps result, so whenever the user is typing ps aux he/she will get the result as ps x only
# 5  
Old 10-13-2007
try doing a grep ?
# 6  
Old 10-13-2007
The OP wants to actually make the command output 'ps x' even if run as 'ps aux'. That will probably require changing the source code for 'ps'. This is BSD, so if you can, just open up the source and make the changes. You might also be able to search for a ps that is modified to do this, but I don't know where you might find that. Check with BSD communities - you may get help.
# 7  
Old 10-13-2007
perhaps I'm missing something obvious here but surely you could just do something like follows:

1. Rename ps to ps_orig
2. Create a 2 line shell script called ps in the same directory as ps was like follows:
Code:
#!/bin/bash
ps_orig -x

3. Chmod 555 ps (same as ps_orig or whatever you want)

I just did it, albeit on a FC5 box, and it works...
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Grep command to show the number of results

Hi I wanted to know if there is an option in grep command to show the number of results (not the number of lines of findings). Thanks (14 Replies)
Discussion started by: abdossamad2003
14 Replies

2. Shell Programming and Scripting

I want to add a variable for the results from the formula of one variable and results of another var

Good morning all, This is the file name in question OD_Orders_2019-02-19.csv I am trying to create a bash script to read into files with yesterdays date on the file name while retaining the rest of the files name. I would like for $y to equal, the name of the file with a formula output with... (2 Replies)
Discussion started by: Ibrahim A
2 Replies

3. Red Hat

User is a Part of a Group But Group Details Do Not Show the User

Hi, In the following output you can see the the user "richard" is a member on the team/group "developers": # id richard uid=10247(richard) gid=100361(developers) groups=100361(developers),10053(testers) but in the following details of the said group (developers), the said user... (3 Replies)
Discussion started by: indiansoil
3 Replies

4. Shell Programming and Scripting

Show "uniq -c" results only for more than X occurrences

Say I have test.txt with the following data: user1 mailbox11 IP1 user1 mailbox12 IP2 user2 mailbox21 IP1 user3 mailbox31 IP1 user1 mailbox11 IP1 user1 mailbox11 IP1 user1 mailbox11 IP1 user1 mailbox12 IP2 user2 mailbox21 IP1 user2 mailbox21 IP1 user2 mailbox21 IP1 user2 mailbox21 IP1... (4 Replies)
Discussion started by: striker4o
4 Replies

5. Shell Programming and Scripting

Can ctag and cscope support recording search results and displaying the history results ?

Hello , When using vim, can ctag and cscope support recording search results and displaying the history results ? Once I jump to one tag, I can use :tnext to jump to next tag, but how can I display the preview search result? (0 Replies)
Discussion started by: 915086731
0 Replies

6. UNIX for Dummies Questions & Answers

If user has own crontab, results in accumulation of root CRON processes

Hello, I seem to be having a problem with accumulation of root CRON jobs occuring when I have a user's cron job(s) running. Here is an example of a user's crontab file: */1 * * * * echo "hello" > /dev/nullps aux|grep CRON root 14333 0.0 0.0 91236 2172 ? S ... (12 Replies)
Discussion started by: Narnie
12 Replies

7. UNIX for Advanced & Expert Users

Possible to show in which directory a user can write?

Hi Gurus, is there a possibility to show where a user can write to? i want to see all directories where a user has permissions to write to. Kind Regards FranzB (0 Replies)
Discussion started by: FranzB
0 Replies

8. OS X (Apple)

Show operating system, current user & network

I have found an excellent OS X pref pane that allows you to output log files or terminal commands/scripts onto the desktop in the background. What I want to do is create a script that outputs the following... - Mac OS X Version and Build (As shown in the about this mac) - Current username -... (6 Replies)
Discussion started by: digitaljunkie
6 Replies

9. UNIX for Dummies Questions & Answers

show all user account

I have a question about show all create user account. What commend do that thank`s for your help :) (6 Replies)
Discussion started by: Deux
6 Replies
Login or Register to Ask a Question