?
Solved

process info

Posted on 2005-03-28
14
Medium Priority
?
284 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
14 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
Industry Leaders: 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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
Course of the Month9 days, 9 hours left to enroll

762 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