The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-31-2008
nehaquick nehaquick is offline
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.
  #2 (permalink)  
Old 02-01-2008
ynilesh's Avatar
ynilesh ynilesh is offline
Registered User
  
 

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

This will display you processes running by perticular user.
  #3 (permalink)  
Old 02-01-2008
nehaquick nehaquick is offline
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.
  #4 (permalink)  
Old 02-01-2008
Yogesh Sawant's Avatar
Yogesh Sawant Yogesh Sawant is offline Forum Staff  
Part Time Moderator and Full Time Dad
  
 

Join Date: Sep 2006
Location: Rossem, Tazenda
Posts: 1,086
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 04:25 AM..
Sponsored Links
Closed Thread

Bookmarks

Tags
shell scripting

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:24 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0