Buffon
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.
test*
I am trying to do it in Fedora.
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 :(
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.
ps -ef | grep " test"
This will eliminate results that starts, for example, like "atest", "thetest" etc.
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..)
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..)
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.
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.
ASKER
last thing, can you explain parameters:
-b
-n
1
-b
-n
1
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Buffon, you sure you gave your points to the one you intended??
ASKER
sorry you are right, I didnt notice that its someone else, I'll request from moderators to change.
Thank you.
ps -ef | grep test
To show a list of all running processes and cpu activity in real time run the following command:
top