Ps command on cpu usage and time

Hi All,

Am very new to Linux and unix ...need below help .
need to list of process consuming more than 40% cpu and which are older than 10 days of a particular user ....

Thanks
V

If you have a process using 40% CPU and (keyword AND) older than 10 days, you need to kill it, or fix it :slight_smile:

Auditing. Do you have any auditing running? The question's vague, but this isn't the kind of thing you can just 'pluck' out of the air.

first i need check which process are those consuming more than 40% cpu AND 10 days older and then need to fix them

---------- Post updated at 01:29 AM ---------- Previous update was at 01:11 AM ----------

can someone help me with the command

Hello venky456,

So this is how I would deal with this kind of situation during the period of issue.
Check the server's memory and cpu first with commands as follows.
To get memory details:

free -g

To get CPU details: This will run 20 times in difference of 1 second or so, you could increase the values as per your convenience.
Solution 1st:

vmstat 1 20

Solution 2nd: This will provide you all processes and you could sort it as per your need for CPU, memory etc and could find out the culprits.

top
OR
htop

There are other ways too, but you could take it as a starting point. Let me know in case of any queries.

Thanks,
R. Singh

Now, your question is quite vague. What is your ultimate goal? For finding the process(es), you already named the ps command - does it do what you want or are you stuck somewhere?

If you want to go further, analyze and correct the program / application - which is the way to go - there's more than one command necessary. You need to dig deep into the run time environment, the input data and channels, and eventually read and understand the program's source code. Be prepared for a lengthy process for "fixing" the culprit.