The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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
Detecting a key combination mobile01 High Level Programming 11 12-22-2006 05:46 AM
shell help - file combination ting123 UNIX for Dummies Questions & Answers 4 06-28-2006 09:50 PM
awk and file combination sickboy UNIX for Dummies Questions & Answers 1 06-13-2005 06:02 PM
Combination Of commands rahulrathod UNIX for Dummies Questions & Answers 2 12-14-2004 03:32 AM
Partition combination gardarm Filesystems, Disks and Memory 3 03-14-2002 03:35 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-31-2008
Registered User
 

Join Date: Jan 2008
Posts: 7
combination of two commands

I want to show a output like this
Lee Ballancore
PID TTY TIME CMD
31799 pts/3 00:00:00 vim
31866 pts/3 00:00:00 vim
2495 pts/7 00:00:00 vim
8368 pts/0 00:00:00 vim
9544 pts/2 00:00:00 ps

Alistairr Rutherford
PID TTY TIME CMD
8368 pts/0 00:00:00 vim
9544 pts/2 00:00:00 ps

although i m getting the output with ps -a command but i m not able to show it separately along with the user name (not login name) on the top. I realise that it is the combination of finger and ps -a. but i dont know how to select only the name and display it separately for all the users logged on. is it possible for me to do this without the use od awk command.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 01-31-2008
ynilesh's Avatar
Registered User
 

Join Date: Oct 2007
Location: Bangalore, India.
Posts: 174
ps -a -u {username}

This will display you processes running by perticular user.
Reply With Quote
  #3 (permalink)  
Old 01-31-2008
Registered User
 

Join Date: Jan 2008
Posts: 7
Question Combination of 2 commands

Thanks for the reply. but this command will only show one particular user. my sript has to find all the users looged on to the systems and show their current processes in the form as mentioned above. it should show the name of the user(not login name which comes in the finger command) on the top and below it should list the PID, TTY, TIME and CMD for each individual user.
Reply With Quote
  #4 (permalink)  
Old 02-01-2008
Yogesh Sawant's Avatar
Part Time Moderator and Full Time Dad
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 767
does this help, then?
Code:
for username in `who | cut -d " " -f1 | sort | uniq`; do echo `grep $username /etc/passwd | cut -d ':' -f 5`; ps -a -u $username; done

Last edited by Yogesh Sawant; 02-01-2008 at 12:25 AM.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
/etc/passwd, shell scripting

Thread Tools
Display Modes




All times are GMT -7. The time now is 06:53 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0