Replace
[1] with the name of the process.
[2] with the name of the text file where the output is need to be recorded.
while [ 1 ] do
top -n 1 -p $(pidof firefox[1]) -b >> topoutput.txt[2] sleep 0.1 done If you need to track the process just with the process id use below script.
Replace
[3] with the id of the process.
while [ 1 ] do
top -n 1 -p 2304[3] -b >> topoutput.txt[2] sleep 0.1 done
Write above codes with your favourite text editor and save it with .shTo start this batch process via shell type
bash <file name of the shell script>.sh