Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 23 Jul 2018, 05:58
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to see processes or resources used by an application
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [3 Posts]  
Author Message
musher0


Joined: 04 Jan 2009
Posts: 12425
Location: Gatineau (Qc), Canada

PostPosted: Thu 21 Dec 2017, 21:54    Post subject:  How to see processes or resources used by an application
Subject description: Various command-line tools.
 

Hello all.

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:
htop -p `pgrep geany`
-- `pgrep geany` gives htop the process ID number it needs to inform you on geany.
Typing < htop -p geany > by itself won't work.

Code:
ps | grep geany
-- Typing < ps > by itself will provide you with an ultra long listing of everything
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:
pstree -p `pgrep geany`
-- again used with pgrep
-- 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:
lsof -c geany | more
-- < | more > is used so we can see one screen of info at a time. The whole listing
is about 117 lines long.

If we want to limit the amount of info, we type this:
Code:
lsof -c geany | grep -v -E "font|ttf|so|mo|locale|null|cache" | more

Explanation of the grep exclusions:
-- 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.

_________________
musher0
~~~~~~~~~~
Siempre será canción nueva... (V. Jara, Manifiesto)

Last edited by musher0 on Fri 22 Dec 2017, 01:42; edited 1 time in total
Back to top
View user's profile Send private message 
phat7

Joined: 05 Jun 2015
Posts: 112

PostPosted: Thu 21 Dec 2017, 23:13    Post subject: Re: How to see processes or resources used by an application
Subject description: Various command-line tools.
 

Quote:

To find the resources geany is using, we can type:

Code:
htop -c `pgrep geany`

Code:
# htop -c `pgrep geany`
htop: invalid option -- 'c'
Back to top
View user's profile Send private message 
musher0


Joined: 04 Jan 2009
Posts: 12425
Location: Gatineau (Qc), Canada

PostPosted: Fri 22 Dec 2017, 01:41    Post subject: Re: How to see processes or resources used by an application
Subject description: Various command-line tools.
 

phat7 wrote:
Quote:

To find the resources geany is using, we can type:

Code:
htop -c `pgrep geany`

Code:
# htop -c `pgrep geany`
htop: invalid option -- 'c'
Sorry. Typo corrected above. That should be a "p".
Thanks for having noticed.

_________________
musher0
~~~~~~~~~~
Siempre será canción nueva... (V. Jara, Manifiesto)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [3 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2530s ][ Queries: 12 (0.0698s) ][ GZIP on ]