Link to home
Start Free TrialLog in
Avatar of Buffon
BuffonFlag for Israel

asked on

process info

How can I see the process info by name, I mean I want to see list of processes that start with test, like:
test*

I am trying to do it in Fedora.
Avatar of ben-gur
ben-gur

To show all processes with "test" in the name:
ps -ef | grep test

To show a list of all running processes and cpu activity in real time run the following command:
top

Avatar of Buffon

ASKER

>> ps -ef | grep test

tried it, the weird thing that it gives me different pid each time I run it, and its wrong (checked it with top)

>> top

cannot see all the processes on the screen, connecting through ssh :(
You may also put a space before the word, like this:
ps -ef | grep " test"

This will eliminate results that starts, for example, like "atest", "thetest" etc.
Avatar of Buffon

ASKER

thats not the problem, it shows process named test, but as I said it shows different and wrong pid every time.
Sorry, I saw your reply only after submitting mine.

Anyway, it is possible that the process you are monitoring is restarting. This is why you get different PIDs every time.

And it is possible that if you type "ps -ef | grep test" you will see the grep process as well, like this:
#ps -ef | grep test
root     23937 23778  0 13:45 pts/2    00:00:00 grep test

And in this case the PID would definitely would be different as the grep is restarting every time.

regarding the top command, try:
top -b -n 1 | grep test

(Try to put a real process name instead of "test" to view real results..)
Avatar of Buffon

ASKER

if top just hangs this means that there is no such process running?
Right, if "top -b -n 1 | grep test" command does not return a thing, then there is no such process.

Note that the ps command show you child processes as well.
And the top command is quite a resource consumer so it is not recommended to leave it open on a production system.
Avatar of Buffon

ASKER

last thing, can you explain parameters:
-b
-n
1
SOLUTION
Avatar of kusuma_hs
kusuma_hs

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Buffon, you sure you gave your points to the one you intended??
Avatar of Buffon

ASKER

sorry you are right, I didnt notice that its someone else, I'll request from moderators to change.
Thank you.