LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 05-24-2017, 04:40 AM   #1
43L@eudc
LQ Newbie
 
Registered: Jan 2017
Posts: 1

Rep: Reputation: Disabled
process memory history


Hi,

I am Angel a newbie...I have a question.

Does anybody know how to check the history of which process took up high memory usage for past hours or days? is there such a log for this?

Many Thanks
 
Old 05-24-2017, 05:02 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 16,615

Rep: Reputation: 5607Reputation: 5607Reputation: 5607Reputation: 5607Reputation: 5607Reputation: 5607Reputation: 5607Reputation: 5607Reputation: 5607Reputation: 5607Reputation: 5607
in general it is not stored, but obviously there is a way (there are several ways) available to monitor a system and you can collect/access these information.
https://www.linux.com/blog/5-command...ry-usage-linux
 
1 members found this post helpful.
Old 05-24-2017, 05:59 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 19,780

Rep: Reputation: 3573Reputation: 3573Reputation: 3573Reputation: 3573Reputation: 3573Reputation: 3573Reputation: 3573Reputation: 3573Reputation: 3573Reputation: 3573Reputation: 3573
To do historical analysis you need a tool that can monitor per process and store the data automatically for all processes. This has never been a standard Linux.
collectl and collectd are two examples - both require some setup prior to the events you want to investigate. Then you can query variously.
 
1 members found this post helpful.
Old 05-24-2017, 06:07 AM   #4
dejank
Member
 
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229

Rep: Reputation: Disabled
Not that I know off, but it can be achieved with some small bash scripts. For example:

https://stackoverflow.com/questions/...ption-on-linux

Also, you could use combinations of watch and ps, in this way:

Code:
watch 'ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head'
When you see what it does, you could redirect its output to some file, or even use tee command to both display output in terminal and append it to some file. Use man watch, man ps and man tee to find some solution that you will be satisfied with, like what intervals you want to watch and how to achieve that with watch command. You could also use something like:

Code:
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head >> watchlog
That will give you output of top 9 processes by cpu usage(replace that part with --sort=-%mem to get by memory usage) and append it to file watchlog. If you set it as cron job, it could give you what you want. Just remember to clean that file from time to time, or to make bash script that will do that for you and run it every week, month or so.

Last edited by dejank; 05-24-2017 at 06:35 AM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find the history of dead process - Redhat redhatexp Linux - Newbie 3 03-01-2017 12:44 AM
Error while saving memory pages of a process- Sleeping in memory from invalid context Deep Narayan Dubey Linux - Kernel 1 04-05-2012 02:58 PM
How to kill the Bash process without clearing the history? kevinx Linux - Newbie 6 02-08-2012 04:01 AM
find history of a job killed by "kernel: Out of Memory: Killed process" poulacou Linux - Server 3 09-20-2007 04:24 PM
Help Configuring the Memory Used by a Process in RedHat? (Cache Memory on CPU) geogecko Linux - General 3 02-23-2005 03:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration