I want to get the CPU and memory usage of a single process on Linux - I know the PID. Hopefully, I can get it every second and write it to a CSV using the \'watch\' command
As commented in caf's answer above, ps and in some cases pidstat will give you the lifetime average of the pCPU. To get more accurate results use top. If you need to run top once you can run:
top -b -n 1 -p
or for process only data and header:
top -b -n 1 -p | tail -3 | head -2
without headers:
top -b -n 1 -p | tail -2 | head -1