![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Automatically Running Scripts | jeffreydavisjr | UNIX for Dummies Questions & Answers | 4 | 11-19-2008 05:05 AM |
| Scripts and changing users | bonekrusher | UNIX for Dummies Questions & Answers | 1 | 02-05-2008 08:55 AM |
| Running scripts parallely | santho | UNIX for Dummies Questions & Answers | 4 | 07-23-2006 12:42 PM |
| Running three scripts parallelly | anwarsait | Shell Programming and Scripting | 1 | 07-18-2006 01:20 AM |
| shell scripts to create 100 users | xiamin | UNIX for Dummies Questions & Answers | 9 | 09-07-2001 01:47 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
ps -e -o"user,args" | grep <scriptname> | nawk '{ print $1 }' | sort -u
Maybe you have to replace "nawk" by "awk" depinding on your system. example: ps -e -o"user,args" | sc[r]ipt.sh | nawk '{ print $1 }' | sort -u Put 1 letter of the <scriptname> between "[" and "]". That way the "grep" itself will not be part of the result. Compare e.g. # ps -ef | grep sshd user3 306 1 0 Feb 09 ? 0:16 /usr/lib/ssh/sshd user2 14740 14733 0 17:25:44 ? 0:06 /usr/lib/ssh/sshd user1 14733 306 0 17:25:43 ? 0:00 /usr/lib/ssh/sshd user2 23404 14773 0 21:46:36 pts/1 0:00 grep sshd or # ps -ef | grep ss[h]d user3 306 1 0 Feb 09 ? 0:16 /usr/lib/ssh/sshd user2 14740 14733 0 17:25:44 ? 0:06 /usr/lib/ssh/sshd user1 14733 306 0 17:25:43 ? 0:00 /usr/lib/ssh/sshd effectively "ps -ef | grep ss[h]d" will do the same as "ps -ef | grep sshd | grep -v grep" |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|