Why use tools when you can create your own.
When you run px aux
we can see multiple status.
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
We will try to gather few data from here by reading the proc
files in linux system:
This articles is increment over this article.
Try the following command in terminal to filter the PID from ps aux
$ ps aux|awk ‘{print $2}’
Now, if you go to proc
folders you can see multiple folders with integers name. Each folder represents the process running in the system and the status regarding it.
$ ls /proc/|grep -ioE “[0–9]”
Weirdly enough all the folders with numbers that you see in the proc folder are the same ones you see in the PID of ps aux
command. Fun fact about the folders are that their size is 0. It contains multiple files inside it_._
#shell #go #linux #golang