11/9/2023 0 Comments Linux memory usage by 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. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |