Processes by Actual names


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Processes by Actual names
# 1  
Old 05-13-2008
Question Processes by Actual names

hi all.

Is there any way to get the original names (not the login names) of users currently logged on to the machine and the processes they are logged on to...names as in abc xyz and not abc.xyz

I dont want to first use w -s and then loops to arrange the information, and i cant figure out how to use grep and then display the users.

$ w -s, $ users, $ ps commands can not be used in the best of knowledge. Is there any other way..
# 2  
Old 05-13-2008
Code:
w -s | awk 'BEGIN { getline; getline } {print $0}' | cut -c1-8,16-

You may need to alter the "16" to another number to get exactly what you want.
Your output of w -s may vary from mine.
# 3  
Old 05-13-2008
Thank You jim, but the output is still exactly the same as w -s on my system. I cant figure out why...

Basically what I'm trying to do is first read the logged on users using the 'users' command, save it in a varible and then running a while loop to get the processes according to the logged on users.
i.e.

#!bin/bash

Code:
var=$(users);

or something like

Code:
while read $(users)
do
w $user
done

but its giving me an 'invalid identifier' error
should i be using 'case' for this.

Last edited by kartikkumar84@g; 05-13-2008 at 07:40 PM.. Reason: solution found partly
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SVN for actual VirtualHost

hi, Earlier I had this thread posted on "UNIX for Experts" Group here in unix.com, but somehow no one bothered to respond, so I thought someone might be able to help me here. In short, I have to make accessible a directory via SVN to all 5 developers, call it /var/www/html/beta3 ... (0 Replies)
Discussion started by: busyboy
0 Replies

2. HP-UX

Actual date minus six months (HP UX)

Hi there, is it possible to get the actual date minux six months with just a simple command? It's easy with Linux but on HP Unix (for me) impossible ;) Best wishes (3 Replies)
Discussion started by: System
3 Replies

3. AIX

Trying to verify actual switchport speed

Connecting network adapter from 100MB switchport to a 1GB switchport. Trying to verify actual switchport speed. While connected to 100MB switchport lsattr -R -l ent0 -a media_speed shows: 10_Half_Duplex 10_Full_Duplex 100_Half_Duplex 100_Full_Duplex 1000_Full_Duplex Auto_Negotiation ... (2 Replies)
Discussion started by: landog
2 Replies

4. Shell Programming and Scripting

Following Symlinks to Actual Script

I need to have my script know what directory it's in, even if it's run from a symlink located elsewhere. Here's what I've come up with, for the benefit of anyone with a similar need, but I'm also interested to know if there's a more elegant solution. I'd rather not get into awk-land, but I couldn't... (2 Replies)
Discussion started by: jeffclough
2 Replies

5. Shell Programming and Scripting

How to find the actual process name

Dear All I have created customisation appliaction for my application process which look likes below, 364688 ach_outbound -proc nla_acho_equ_01 -format EQUENS0001 DEQ WAIT 1167452 listener -p 42662 hostget_server -proc at_vld 11874 at_vld IDLE 1560634 listener -p 11870 menu IDLE... (4 Replies)
Discussion started by: manas_ranjan
4 Replies

6. Solaris

Identifying and grouping OS processes and APP processes

Hi Is there an easy way to identify and group currently running processes into OS processes and APP processes. Not all applications are installed as packages. Any free tools or scripts to do this? Many thanks. (2 Replies)
Discussion started by: wilsonee
2 Replies

7. UNIX for Dummies Questions & Answers

Processes by User's names

Hi All I am being trained in unix and am tryin to write a script for listing the user Processes by user's names exactly the following manner WITHOUT USING A TEMPORARY FILE or SED OR AWK! The format of the output I want is: Code: James Hallan PID TTY TIME CMD 31799 pts/3 00:00:00 vim ... (2 Replies)
Discussion started by: kartikkumar84@g
2 Replies

8. Shell Programming and Scripting

Processes by User's actual names

Hi All I am being trained in unix and am tryin to write a script for listing the user Processes by user's names exactly the following manner WITHOUT USING A TEMPORARY FILE or SED OR AWK! The format of the output I want is: James Hallan PID TTY TIME CMD 31799 pts/3 00:00:00 vim 31866... (1 Reply)
Discussion started by: kartikkumar84@g
1 Replies

9. UNIX for Advanced & Expert Users

Monitoring Processes - Killing hung processes

Is there a way to monitor certain processes and if they hang too long to kill them, but certain scripts which are expected to take a long time to let them go? Thank you Richard (4 Replies)
Discussion started by: ukndoit
4 Replies

10. Solaris

Need actual bootpd for solaris

Hi everybody, i have downloaded some archieves but i couldn't compile it without errors. please help... where can i find a bootp that works?! my hardware: sparc prozessor with solaris 8 (5.8 (2.8)) thanks Johnny (0 Replies)
Discussion started by: johnnypark
0 Replies
Login or Register to Ask a Question