I'm using macOS Sierra and I would like to log a process with the top
command and store all the information in a file. I'm using the following command:
top | grep --line-buffered "PROCESS" > test.txt
This perfectly works, but I would like to select only certain columns as the reseults:
- PID
- Memory Usage
- CPU Usage
- Network Usage
- Disk Usage
Is there a way to filter the top
result and select only the columns of my interest?
awk '/PROCESS/{print $1,$2}'
instead of grep + awk combo :) – Sundeep Sep 30 '16 at 04:51