Here are various ways to see the processes or resources used by an application.
This can be useful for debugging a weird behavior in a program or simply out of
curiosity.
I am not including any screen shots, because by just typing the command in
console, you will have an illustration of what it does.
Let's say we have geany open. (But we can do this for any program.)
To find the resources geany is using, we can type:
Code: Select all
htop -p `pgrep geany`
Typing < htop -p geany > by itself won't work.
Code: Select all
ps | grep geany
running on your Linux machine. We seldom need all that info; we usually want
something more focused, which is why we filter the info through < grep >.
Note: you can type < ps --help > to see the many possible parms for < ps >. But
the use with a pipe to grep gives more direct info about a program.
Code: Select all
pstree -p `pgrep geany`
-- info is similar to what < ps | grep geany > will give you, but with the process(es)
that called it, etc., in tree form.
~~~~~~~~~~
lsof is probably the most informative :
(The real one please; by comparison, the busybox cut-down version gives limited
info. May I suggest one of the pet archives on this page.
They all offer the complete lsof program. Some pet archives there are larger because
they also contain the docs for lsof. At the time of this writing, the lsof-4.89 offered
on that forum page is still the latest version.)
Code: Select all
lsof -c geany | more
is about 117 lines long.
If we want to limit the amount of info, we type this:
Code: Select all
lsof -c geany | grep -v -E "font|ttf|so|mo|locale|null|cache" | more
-- font|ttf : exclude the fonts geany is using
-- so : exclude the libraries it is using
-- mo|locale : exclude any language files
-- null : exclude any process going to /dev/null
-- cache : exclude the cache(s) geany is using.
You can mix and match those exclusions, use one or two or three, etc., instead of
the whole bunch, depending on what you need to know.
By contrary, you can see what information lsof is including by default about geany
-- or any other program. lsof provides a great deal of info.
~~~~~~~~~~
The above tools provide a different angle as to what resources and processes are
being used by a program. Use the one that gives you the info you need to know.
If you know of other such tools, please mention them below for our benefit. Thanks.
IHTH. BFN.