How to find out total memory resource usage with ps?

Clash Royale CLAN TAG#URR8PPP
With ps command I can find out how much memory each program uses:
ps -u mertnuhoglu -o pcpu,rss,pid,command
Is it possible to find out the sums of each type of resource usage as well, easily?
memory ps
add a comment |
With ps command I can find out how much memory each program uses:
ps -u mertnuhoglu -o pcpu,rss,pid,command
Is it possible to find out the sums of each type of resource usage as well, easily?
memory ps
1
Note that quantifying memory usage is tricky, because some memory is shared between processes. The sum of the figures you get this way will be an overestimate. RSS is only a rough estimate of how much memory an application uses anyway (it doesn't take into account swapped-out memory or file buffers).
– Gilles
Oct 1 '11 at 22:05
add a comment |
With ps command I can find out how much memory each program uses:
ps -u mertnuhoglu -o pcpu,rss,pid,command
Is it possible to find out the sums of each type of resource usage as well, easily?
memory ps
With ps command I can find out how much memory each program uses:
ps -u mertnuhoglu -o pcpu,rss,pid,command
Is it possible to find out the sums of each type of resource usage as well, easily?
memory ps
memory ps
edited Oct 1 '11 at 22:22
Stéphane Gimenez
19.5k25074
19.5k25074
asked Oct 1 '11 at 9:33
Mert NuhogluMert Nuhoglu
2762410
2762410
1
Note that quantifying memory usage is tricky, because some memory is shared between processes. The sum of the figures you get this way will be an overestimate. RSS is only a rough estimate of how much memory an application uses anyway (it doesn't take into account swapped-out memory or file buffers).
– Gilles
Oct 1 '11 at 22:05
add a comment |
1
Note that quantifying memory usage is tricky, because some memory is shared between processes. The sum of the figures you get this way will be an overestimate. RSS is only a rough estimate of how much memory an application uses anyway (it doesn't take into account swapped-out memory or file buffers).
– Gilles
Oct 1 '11 at 22:05
1
1
Note that quantifying memory usage is tricky, because some memory is shared between processes. The sum of the figures you get this way will be an overestimate. RSS is only a rough estimate of how much memory an application uses anyway (it doesn't take into account swapped-out memory or file buffers).
– Gilles
Oct 1 '11 at 22:05
Note that quantifying memory usage is tricky, because some memory is shared between processes. The sum of the figures you get this way will be an overestimate. RSS is only a rough estimate of how much memory an application uses anyway (it doesn't take into account swapped-out memory or file buffers).
– Gilles
Oct 1 '11 at 22:05
add a comment |
2 Answers
2
active
oldest
votes
You could sum the usage columns with awk:
ps --no-headers -u $USER -o pcpu,rss | awk 'cpu += $1; rss += $2 END print cpu, rss'
You might also be interested in the free command for memory usage:
$ free
total used free shared buffers cached
Mem: 2055480 1806596 248884 0 14016 346276
-/+ buffers/cache: 1446304 609176
Swap: 2097148 132980 1964168
The output is in kilobytes (use free --mega for megabytes or free -m for mebibytes). In particular, the used, +/- buffers/cache entry is something like the total physical memory used (by everyone).
add a comment |
You can try:
$ ps -eo vsz,comm= | awk 'NR>1u[$2]+=$1ENDfor(i in u) print u[i]"="i'
2
Do not only paste command. please also mansion/explain how this command use to solve this question.
– Tejas
Dec 18 '14 at 9:54
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f21836%2fhow-to-find-out-total-memory-resource-usage-with-ps%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could sum the usage columns with awk:
ps --no-headers -u $USER -o pcpu,rss | awk 'cpu += $1; rss += $2 END print cpu, rss'
You might also be interested in the free command for memory usage:
$ free
total used free shared buffers cached
Mem: 2055480 1806596 248884 0 14016 346276
-/+ buffers/cache: 1446304 609176
Swap: 2097148 132980 1964168
The output is in kilobytes (use free --mega for megabytes or free -m for mebibytes). In particular, the used, +/- buffers/cache entry is something like the total physical memory used (by everyone).
add a comment |
You could sum the usage columns with awk:
ps --no-headers -u $USER -o pcpu,rss | awk 'cpu += $1; rss += $2 END print cpu, rss'
You might also be interested in the free command for memory usage:
$ free
total used free shared buffers cached
Mem: 2055480 1806596 248884 0 14016 346276
-/+ buffers/cache: 1446304 609176
Swap: 2097148 132980 1964168
The output is in kilobytes (use free --mega for megabytes or free -m for mebibytes). In particular, the used, +/- buffers/cache entry is something like the total physical memory used (by everyone).
add a comment |
You could sum the usage columns with awk:
ps --no-headers -u $USER -o pcpu,rss | awk 'cpu += $1; rss += $2 END print cpu, rss'
You might also be interested in the free command for memory usage:
$ free
total used free shared buffers cached
Mem: 2055480 1806596 248884 0 14016 346276
-/+ buffers/cache: 1446304 609176
Swap: 2097148 132980 1964168
The output is in kilobytes (use free --mega for megabytes or free -m for mebibytes). In particular, the used, +/- buffers/cache entry is something like the total physical memory used (by everyone).
You could sum the usage columns with awk:
ps --no-headers -u $USER -o pcpu,rss | awk 'cpu += $1; rss += $2 END print cpu, rss'
You might also be interested in the free command for memory usage:
$ free
total used free shared buffers cached
Mem: 2055480 1806596 248884 0 14016 346276
-/+ buffers/cache: 1446304 609176
Swap: 2097148 132980 1964168
The output is in kilobytes (use free --mega for megabytes or free -m for mebibytes). In particular, the used, +/- buffers/cache entry is something like the total physical memory used (by everyone).
edited Feb 16 at 13:05
Community♦
1
1
answered Oct 1 '11 at 20:36
Doctor JDoctor J
38137
38137
add a comment |
add a comment |
You can try:
$ ps -eo vsz,comm= | awk 'NR>1u[$2]+=$1ENDfor(i in u) print u[i]"="i'
2
Do not only paste command. please also mansion/explain how this command use to solve this question.
– Tejas
Dec 18 '14 at 9:54
add a comment |
You can try:
$ ps -eo vsz,comm= | awk 'NR>1u[$2]+=$1ENDfor(i in u) print u[i]"="i'
2
Do not only paste command. please also mansion/explain how this command use to solve this question.
– Tejas
Dec 18 '14 at 9:54
add a comment |
You can try:
$ ps -eo vsz,comm= | awk 'NR>1u[$2]+=$1ENDfor(i in u) print u[i]"="i'
You can try:
$ ps -eo vsz,comm= | awk 'NR>1u[$2]+=$1ENDfor(i in u) print u[i]"="i'
edited Dec 18 '14 at 10:09
a CVn
17.3k851106
17.3k851106
answered Dec 18 '14 at 9:48
Daniel LerchDaniel Lerch
1091
1091
2
Do not only paste command. please also mansion/explain how this command use to solve this question.
– Tejas
Dec 18 '14 at 9:54
add a comment |
2
Do not only paste command. please also mansion/explain how this command use to solve this question.
– Tejas
Dec 18 '14 at 9:54
2
2
Do not only paste command. please also mansion/explain how this command use to solve this question.
– Tejas
Dec 18 '14 at 9:54
Do not only paste command. please also mansion/explain how this command use to solve this question.
– Tejas
Dec 18 '14 at 9:54
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f21836%2fhow-to-find-out-total-memory-resource-usage-with-ps%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Note that quantifying memory usage is tricky, because some memory is shared between processes. The sum of the figures you get this way will be an overestimate. RSS is only a rough estimate of how much memory an application uses anyway (it doesn't take into account swapped-out memory or file buffers).
– Gilles
Oct 1 '11 at 22:05