Q. How do I find out what process are eating up all my memory. Is it possible to find out how long that memory has been allocated to particular process? How do I kill that process to free up memory?
A. You need to use the top command which provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks currently being managed by the Linux kernel.
Simply type top command:
# top
top command will tell you the percentage of physical memory a particular process is using at any given time. As far as I know, there is no easy way that can tell how long that memory has been allocated.
You can also use ps command to get more information about process.
# ps aux | less
To kill process use kill command under Linux. Read man page of top and ls for more information.
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop












{ 6 comments… read them below or add one }
i want to find the process execution time in LINUX???
time(command) | grep user|cut -f 2
I recommend using `htop’ instead of top to monitor processes. It’s much friendlier and easy to use, and allows you to do more. (It’s colorized too!)
It’s in the ubuntu repositories, I imagine you can install it easily for debian as well.
I prefer using atop.. which gives all the option network activity, disk activity and many more you can check in the man page of it
I dont know abt redhat and fedora but its there in ubuntu and debian repo
atop and htop will never work on fedora
what about this command:
ps axu | awk '{print $2, $3, $4, $11}' | head -1 && ps axu | awk '{print $2, $3, $4, $11}' | sort -k3 -nr |head -5The result is here
I see the 5 processes which consume most of the memory.
If I want to see the CPU, then I sort after second column => sort -k2
ps axu | awk '{print $2, $3, $4, $11}' | head -1 && ps axu | awk '{print $2, $3, $4, $11}' | sort -k2 -nr |head -5outputs: