Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
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.
is there a way to calculate the total memory consumed by user ?
You don't mean used (which I think was the intent behind post #2), and you do mean by 'a single user' (which I think was the intent behind post #3) and not 'all (ordinary?) users'.
The code in post #3 didn't work for me...which was a pity, as I thought it was a neat idea. Can you explain the awk part, as awk isn't something I normally use, please?
Change username to a valid user name, and try again.
Merely checks for that username and accumulates the first field (size). This is (probably) not what you would expect "size" to represent - see the manpage.
@salasi: What shell are you using? Does 'ps -u <your_username>' show anything?
(sorry about the delay): I was about to say bash, but it was really konsole 2.5 (kde 4.5.1), if that makes a difference. The output from ps -u is in the form:
Look at output of the first part on it's own.
ps -eo size,pid,user,cmd
Since you just need the size and user, how about:
ps -eo size,user
Sometimes when an output on the left hand side of a pipe is blank, it's because of an error on the right hand side, such as a missing or aliased command.
Also, what does "ps --version" return? I've seen similar one-liners using ls & awk that didn't work out right when I tried them because of a small difference in the output such as how recent dates were printed.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.