How do you use top
with just showing the CMD name?
I have used top
with just showing the running process that I want; for example:
$ top -p 19745
And if I want more than one PID, I would use:
$ top -p 19745 -p 19746 -p 19747
I have Googled it, but they don't say how you can do it, even when I try looking at the help in top
it still doesn't show you.
Is there a way you can filter by the CMD name only?
There are certain files that I am running through Apache2, and I want to monitor them only.
afile1.abc
afile2.abc
afile3.abc
afile4.abc
Update
I see this in the man top
page:
x: Command -- Command line or Program name
Display the command line used to start a task or the name of the associated
program. You toggle between command line and name with 'c', which is both
a command-line option and an interactive command.
When you've chosen to display command lines, processes without a command
line (like kernel threads) will be shown with only the program name in
parentheses, as in this example:
( mdrecoveryd )
Either form of display is subject to potential truncation if it's too long
to fit in this field's current width. That width depends upon other fields
selected, their order and the current screen width.
Note: The 'Command' field/column is unique, in that it is not fixed-width.
When displayed, this column will be allocated all remaining screen width
(up to the maximum 512 characters) to provide for the potential growth of
program names into command lines.
Will that do anything for me?
c
, but that doesn't really help... Well it does for me, as the filename starts with "A" – Kevdog777 Jul 30 '14 at 14:41pgrep
. Can you try the updated command? – Ramesh Jul 30 '14 at 14:56top: unknown argument '1'
– Kevdog777 Jul 30 '14 at 14:58top -p
pgrep -d ',' "afile*"`` but then shows the first 3, then disappears... When I try the other command, you gave, I get this:top: unknown argument '7' usage: top -hv | -bcisSH -d delay -n iterations [-u user | -U user] -p pid [,pid ...]
– Kevdog777 Jul 30 '14 at 15:08Ubuntu 12.04.3 LTS
, if that makes any difference? – Kevdog777 Jul 30 '14 at 15:10top
has already started. @Kevdog777, is that correct? – Mark Plotnick Jul 30 '14 at 15:11sleeping
. – Kevdog777 Jul 30 '14 at 15:12