How do you print the number of processes that each user is currently running in Unix?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How do you print the number of processes that each user is currently running in Unix?
# 1  
Old 03-07-2011
How do you print the number of processes that each user is currently running in Unix?

Ok, so I know there's a way to do this, but I've been trying to find out all afternoon with no luck. I think it should print out something like this:

1 bin
2 daemon
6 duo

Where the numbers on the left are the number of processes being run by the user whose name is listed on the right. Is there a way to do this? If so, what commands to I need to use?

Thanks in advance.
# 2  
Old 03-07-2011
Code:
ps aux | sort -k1 - | awk '{print $1}' | uniq -c

is this OK?
This User Gave Thanks to homeboy For This Post:
# 3  
Old 03-07-2011
Yes! It's exactly what I was trying to do! Thank you so much!
# 4  
Old 03-07-2011
maybe this is better:
Code:
ps aux | sort -k1 - | awk '{print $1}' | uniq -c | sort -n

# 5  
Old 03-07-2011
TRY

who |sort |awk '{print $1}'|uniq -c |sort -n
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I find the number of processes running on root?

Is there a certain man command I'm missing here? I searched in ps but I couldn't find something that would give me the number of processes running on root. I only want to see the number of processes, not the processes itself. (2 Replies)
Discussion started by: l3monz
2 Replies

2. Shell Programming and Scripting

Print only processes running for more than 24 hours

How can I print ONLY processes running for more than 24 hours. Using ps command or any other method I use this to get a whole list. ps -eo pid,pcpu,pmem,user,args,etime,cmd --sort=start_time We can also sort the outout of the above command to list processes older than 24 hours using... (9 Replies)
Discussion started by: anil510
9 Replies

3. AIX

How to Identify long running unix processes

Hi All, Need an urgent help, I have a requirement to find long running unix processes.. I have tried the below commands, but not succeed. I need to arrange the unix processess in an order of elapsed time (high to low) that runs in a system. For Eg: Consider we have 3 processes, Pid 1 pid 2... (5 Replies)
Discussion started by: mohamedirfan
5 Replies

4. UNIX for Dummies Questions & Answers

Need Unix command to get all processes running on a port

Hi, Can someone provide me the Linux command to get the list of all processes running on a particular port. Thanks, Sandy (1 Reply)
Discussion started by: sandy8765
1 Replies

5. Shell Programming and Scripting

How to Control Number of Processes Running

Hi Is there a way to count how many processes a script has started, count how many of these have finished, and make the script wait if their difference goes over a given threshold? I am using a script to repeatedly execute a code (~100x) which converts 2 data files into one .plt which is in... (4 Replies)
Discussion started by: drbones
4 Replies

6. Shell Programming and Scripting

Number of processes per each user in a table

Hello guys, what i want to do is to print a table with two columns (user :: #procs) on the stdout. The first column should show the users and the second one the number of processes the respective user runs. I think I need something like the count() - function in sql, don't i? Shell: Bash ... (2 Replies)
Discussion started by: tiptop
2 Replies

7. Shell Programming and Scripting

Keep a certain number of background processes running

I've got a bit of code I'm trying to work on... What i want to happen is ... at all times have four parallel mysql dump and imports running. I found the follow code snippet on the forum and modified it to work by starting four concurrent processes but it waits until all four are done before... (7 Replies)
Discussion started by: dgob123
7 Replies

8. Shell Programming and Scripting

Determine Number of Processes Running

I am pretty new to unix, and I have a project to do. Part of the project asks me to determine the number of processes running and assign it to a variable. I know how to every part of the project but determine the number of processes running. How can I get just the number of processes... (4 Replies)
Discussion started by: wayne1411
4 Replies

9. UNIX for Dummies Questions & Answers

How to check the status of the processes running for the current user?

Hi All, I am new to unix. Can anyone tell me "How to check the status of the processes running for the current user?" Regards, Ravindaran S (1 Reply)
Discussion started by: ravind27
1 Replies

10. UNIX for Advanced & Expert Users

Unix and the maximum number of processes under a 386 box.

Hi ! I would like to know if Unix could launch more than 8192 processes , which is the maximum number of LDTs on a 386 box. Is this done by swapping some memory on the disk ? Thanks for your answers. (0 Replies)
Discussion started by: krhamidou
0 Replies
Login or Register to Ask a Question