pandawqp.blogg.se

Linux track memory usage of process
Linux track memory usage of process






linux track memory usage of process

Finally, run the command shown below top -o +%mem Output USER PID %CPU %MEM VSZ RSS TTY Immukul 5142 0.1 6.3 2581944 239408 pts/0Īs we can see in the above output the processes are sorted in increasing order of the memory consumed by them.Īn alternate option is to make use of the top command itself and following the steps mentioned belowĪfter typing top in your terminal, press SHIFT + M, then sort the MEM per process Command ps aux -sort ‘%mem’ Output USER PID %CPU %MEM VSZ RSS TTY Now that we know a little about the ps command, let’s see the command that will give us the desired output. The output of the above command is huge, so I printed only a chunk of it, and it should be noted that the output can vary. Command ps ef Output UID PID PPID C STIME TTY TIME CMDĠ 1 0 0 25Jun21 ? 19:53.44 /sbin/launchdĠ 56 1 0 25Jun21 ? 0:41.68 /usr/sbin/syslogdĠ 57 1 0 25Jun21 ? 0:59.28 /usr/libexec/UserEventAgent (System) Let’s make use of two examples where first we will print all the processes that are running on your ubuntu machine, and next we will print whether a specific service is running or not. The ps command is short for “process status” and is used to list the currently running processes on your Linux machine along with their PIDs and different options. The first command is the ps command of the Linux operating system. Let’s learn a little bit about the ps command before making use of it to print the processes that are consuming the most memory. The most basic approach is to make use of the ps command that Linux provides and append similar commands with it, mainly the -sort tag and the mem command. There are certain cases where we would like the output to be in a sorted manner somehow, like sorted in the sense that the process which is using the most memory will be at the top. The only issue with that is the processes are not sorted in any order and the order changes frequently. Linux provides the famous top command utility that provides us with all the information about the processes, their time, their respective IDs, how much CPU chunk they are consuming and much more.








Linux track memory usage of process