Find and Kill the process that consumes more memory

How do I find what process/service is consuming more memory and how do I kill/terminate it on Ubuntu Server?
Thyagaraj03Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccrackyCommented:
Use "top":

1. run top
2. order by memory usage by pressing "m"
3. kill the process by:
   - pressing "k"
   - entering the process ID (look at that column)
   - chose the kill "signal"
        15 is "terminate".  If that doesn't work try
        6 is abort.  If that doesn't work try
        9 unconditional kill.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
expert_tanmayCommented:
Use the ps command
ps aux
this will display all the processes with there memory usage in percentage.
Kill the process by its pid
e.g.
kill -15 pid (terminate)
or kill -9 pid (force to kill)
Thyagaraj03Author Commented:
yes it's good. Is there any other way so that I have only listed the process that consumes more memory?
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

expert_tanmayCommented:
ps aux|sort -nr +3

this will sort all the processes based on memory usage....
Thyagaraj03Author Commented:
When I ran the command "ps aux|sort -nr +3" I got the following output:
sort: open failed: +3: No such file or directory
expert_tanmayCommented:
try  ps aux --sort -rss
Thyagaraj03Author Commented:
It is solved
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.