Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
01-04-2010, 09:02 PM
|
#1
|
Senior Member
Registered: May 2008
Distribution: Slackware
Posts: 1,052
Rep:
|
how to check ram usage in linux...
I am running Slackware 13.0. I am aware of free -m, vmstat, top, etc. However, none of these programs display how much ram each program is using. Is there a program that displays how much ram each program is using? I run a headless so I'd need a program that runs in CLI.
I know that top command shows %MEM (only two programs were using 0.1%MEM) but after running free -m I only have a total of 400 MB ram left out of my 1.5 GB of ram. Where is all that lost ram?
Last edited by trist007; 01-04-2010 at 09:05 PM.
|
|
|
01-04-2010, 09:12 PM
|
#2
|
Moderator
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
|
Why don't you post the output of e.g. top here in code tags?
|
|
|
01-04-2010, 09:18 PM
|
#3
|
Senior Member
Registered: Jul 2009
Distribution: OpenSuse 11.1, Fedora 14, Ubuntu 12.04/12.10, FreeBSD 9.0
Posts: 1,571
Rep:
|
free -m shows memory:
total used free shared buffers cached
So what is your question?
|
|
|
01-04-2010, 09:19 PM
|
#4
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
By default top sorts by cpu usage. If you have not tried already it may be useful to get top to sort by memory usage.
Inside top, type "<Shift>-f" then type "n", then type "<Enter>".
Cheers,
Evo2.
|
|
|
01-04-2010, 11:02 PM
|
#5
|
Senior Member
Registered: May 2008
Distribution: Slackware
Posts: 1,052
Original Poster
Rep:
|
Ah yes, top did it, thanks Evo. VIRT is the ram in KB correct?
I am trying to get how much KB of RAM each program is using, not necessarily percentage, which could be calculated but I want convenience hehe.
Last edited by trist007; 01-04-2010 at 11:07 PM.
|
|
|
01-04-2010, 11:06 PM
|
#6
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
Quote:
Originally Posted by trist007
Ah yes, top did it, thanks Evo. VIRT is the ram in KB correct?
|
From the man page:
Code:
o: VIRT -- Virtual Image (kb)
The total amount of virtual memory used by the task. It includes all code, data and shared libraries plus pages that have been swapped out.
VIRT = SWAP + RES.
so yes it seems so.
Cheers,
Evo2.
|
|
|
01-05-2010, 12:06 AM
|
#7
|
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,361
|
Probably of more interest might be RSS. For this sort of thing I find it easiest to run through /proc/*/stat and pull out what I want with awk.
Code:
echo -e "RSS\t\tName\n---\t\t----" ; for i in /proc/*/stat ; do awk '{print $24" \t:\t" $2}' $i 2>/dev/null ; done | sort -nr | head -n 10
|
|
|
01-05-2010, 12:18 AM
|
#8
|
Member
Registered: Feb 2006
Location: Oldsmar, Fl. USA
Distribution: Slackware, Ubuntu
Posts: 176
Rep:
|
There is a program called htop that might do what you want. If you run it as super-user it can do quite a bit of task management as well.
Last edited by Hendronicus; 01-05-2010 at 12:18 AM.
Reason: clarity
|
|
|
01-05-2010, 12:39 AM
|
#9
|
Member
Registered: Feb 2006
Location: Oldsmar, Fl. USA
Distribution: Slackware, Ubuntu
Posts: 176
Rep:
|
Quote:
Originally Posted by trist007
I am running Slackware 13.0. I am aware of free -m, vmstat, top, etc. However, none of these programs display how much ram each program is using. Is there a program that displays how much ram each program is using? I run a headless so I'd need a program that runs in CLI.
I know that top command shows %MEM (only two programs were using 0.1%MEM) but after running free -m I only have a total of 400 MB ram left out of my 1.5 GB of ram. Where is all that lost ram?
|
I just re-read your question and I would venture to guess that your "lost" RAM is actually cache + shared libs. Linux, by default, caches every single disk access up to available RAM and then releases it back if programs need it. There are ways to turn off this behavior but you probably don't want to.
|
|
|
01-05-2010, 08:29 AM
|
#10
|
Senior Member
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824
|
|
|
|
All times are GMT -5. The time now is 12:48 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|