Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

process info

Posted on 2005-03-28
14
Medium Priority
?
285 Views
Last Modified: 2010-04-21
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.
0
Comment
Question by:Buffon
  • 7
  • 5
13 Comments
 
LVL 4

Expert Comment

by:ben-gur
ID: 13643044
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

0
 
LVL 11

Author Comment

by:Buffon
ID: 13643058
>> 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 :(
0
 
LVL 4

Expert Comment

by:ben-gur
ID: 13643082
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.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Author Comment

by:Buffon
ID: 13643089
thats not the problem, it shows process named test, but as I said it shows different and wrong pid every time.
0
 
LVL 4

Expert Comment

by:ben-gur
ID: 13643123
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..)
0
 
LVL 11

Author Comment

by:Buffon
ID: 13643161
if top just hangs this means that there is no such process running?
0
 
LVL 4

Expert Comment

by:ben-gur
ID: 13643178
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.
0
 
LVL 11

Author Comment

by:Buffon
ID: 13643224
last thing, can you explain parameters:
-b
-n
1
0
 
LVL 1

Assisted Solution

by:kusuma_hs
kusuma_hs earned 80 total points
ID: 13643358

       b    Batch  mode.  Useful for sending output from top to other programs or to a
            file.  In this mode, top will not accept command line input. It runs until
            it  produces the number of iterations requested with the n option or until
            killed. Output is plain text suitable for display on a dumb terminal.

       n   Number of iterations. Update the display this number  of  times  and  then
            exit.

       here no. of iterations selected is 1

Regards,
Kusuma
0
 
LVL 4

Accepted Solution

by:
ben-gur earned 1920 total points
ID: 13643460
You can find additional parameters and info by using the man command:
man top
man grep

Note that grep acts only as a filter - it displays all the lines that has a match with the parameter you supplied to grep.
0
 
LVL 4

Expert Comment

by:ben-gur
ID: 13643903
Buffon, you sure you gave your points to the one you intended??
0
 
LVL 11

Author Comment

by:Buffon
ID: 13644034
sorry you are right, I didnt notice that its someone else, I'll request from moderators to change.
0
 
LVL 4

Expert Comment

by:ben-gur
ID: 13644409
Thank you.
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question