how to get list of processes


 
Thread Tools Search this Thread
Top Forums Programming how to get list of processes
# 8  
Old 04-02-2008
If your flavor of Unix supports /proc filesystem then it should be pretty easy to get a little bit of information.

do "cd /proc" and if it works, do an "ls" you should see a bunch of folders, one per running pid. You can read this directory in c like any other (see man page for opendir).

If the flavor of Unix you are using doesn't support this, then you are hosed and back to either a popen for "ps" or looking up the source for it.

Last edited by DreamWarrior; 04-02-2008 at 05:25 PM..
# 9  
Old 04-03-2008
Hm, this indeed seems an easy way to get a list of process-IDs. However, the information inside /proc/<processID> seems to be platform-dependent (and hard to understand anyway). Is there perhaps a way to get information about a process with a specific known ID?
# 10  
Old 04-04-2008
There are different variants of how /proc works but on Linux for example, /proc/12345 contains information about process 12345; if that is not what you want, then perhaps you can explicate on what in particular you are looking for.

Also look at the proc(5) manual page, which documents the facility. (On Linux, at least, the documentation there was somewhat stale, last time I looked; but in general, it's probably correct.)
# 11  
Old 04-05-2008
Try this command

$ top

$ pstree

Good luck
# 12  
Old 05-28-2008
Error List of Processes in UNIX Box

Can someone please answer my query?

I need to know whether I can find out the complete list of processes that ran on a server instance in a UNIX Box under a particular user ID on a particular date.
# 13  
Old 05-31-2008
Quote:
Originally Posted by ranitb
Can someone please answer my query?

I need to know whether I can find out the complete list of processes that ran on a server instance in a UNIX Box under a particular user ID on a particular date.
This should have been a new thread. Please don't club this under an existing one.

Coming back to the question.

Yes, its possible. Only tweak needed is to extract process information and apply all the filters that you are interested in.
# 14  
Old 06-04-2008
just try in ur c code
system(ps -eaf);
it will fill ur screen with the list of process running on ur unix system..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

List processes using my memory

Here is the output of top command So you see 99% of memory is in use -> Mem: 66005468k total, 65662548k used, How can I find out all processes consuming this 99% memory in descending order of consumption i.e. starting with processes eating more memory. I need the total of the output to... (3 Replies)
Discussion started by: mohtashims
3 Replies

2. UNIX for Advanced & Expert Users

List all background processes

How do I list the process in a Unix based system which are running in background? The following are options that I'm aware of, but they may not be appropiate. a. using ps -ef , and getting records of processes for which STATUS='S'(uninterruptible sleep) b. using jobs -l, and filtering... (5 Replies)
Discussion started by: kumarjt
5 Replies

3. UNIX for Advanced & Expert Users

Kill a list of processes

I am trying to kill a list of processes. I have found these two ways to list a group of process id's on a single line. How would I go about killing all of these processes all on one line? $ ps aux | grep 6243 | grep "a.out" | awk '{printf "%s ",$2}'ps aux | grep 6243 | grep "a.out" | awk... (8 Replies)
Discussion started by: cokedude
8 Replies

4. Solaris

Get list of running network processes

Hello All I am trying to get a list of process or applications runninging on the network only. I should emphasize that im not interested in the application or process if its not using the network. I tried the good old netstat comand, but im not able to figure out how to list the running... (8 Replies)
Discussion started by: busi386
8 Replies

5. UNIX for Dummies Questions & Answers

List processes that are running on other hosts

Hi: How to list processes from all hosts, as opposed to the one you are working at? "ps ux" appears to list processes of the user on a single host only. Thanks. N.B Phil (5 Replies)
Discussion started by: phil518
5 Replies

6. UNIX for Dummies Questions & Answers

What are these different tty processes(tty1,tty2..) running as root mentioned n the list below.

Hi, I need your help to understand about different processes(tty1,tty2,tty3...) running as root as shown below .What exactly these processes do? root@bisu-desktop:~# ps -eaf | grep -e tty -e UID UID PID PPID C STIME TTY TIME CMD root 761 1 0 10:30 tty5 ... (4 Replies)
Discussion started by: crazybisu
4 Replies

7. Shell Programming and Scripting

Preparing a list of spawned processes

Hi All I'm currently trying to develop a script which will find the child processes of a process ID already passed to the script. I then need the script to look for spawned processes of these child processes and so on until it can't find any more. For example At the moment, I have to... (6 Replies)
Discussion started by: huskie69
6 Replies

8. Shell Programming and Scripting

Need to list 3 days old processes

ps -xfu <user name> this command line will list all the process currently running for <user name>. I need to filter this output. I need all the process which are running for more than 3 days(excluding demon/sys process) . The list should include PID, PPID, STIME, process/command. I am using... (20 Replies)
Discussion started by: Sriranga
20 Replies

9. SuSE

List of processes/ which ones to stop

Hi there, I've install a testserver with SLES 11.0! I'll install/test XEN + WebServer not all things at the moment! In a first time, I'd like to stop all unuse processes... but I don't understand all processes! As someone a list of all processes with his signification and which should/could... (3 Replies)
Discussion started by: hiddenshadow
3 Replies

10. AIX

Need a list of top 10 CPU using processes (also top 10 memory hogs, separately)

Okay, I am trying to come up with a multi-platform script to report top ten CPU and memory hog processes, which will be run by our enterprise monitoring application as an auto-action item when the CPU and Memory utilization gets reported as higher than a certain threshold I use top on other... (5 Replies)
Discussion started by: thenomad
5 Replies
Login or Register to Ask a Question