I want to add my own header to the print out from this command and save to a file: top -p 1198172,1198173,1198174.1198175,1198176,1198177,1198178 | awk '{print $1,"---",$9,"---",$10,"---",$12}'

  • Add > file_name after the command.
    – Pilot6
    Aug 17, 2017 at 12:52

1 Answer 1


I think this is what you want:

(echo "Headers are fun";top -p 1198172,1198173,1198174,1198175,1198176,1198177,1198178 | awk '{print $1,"---",$9,"---",$10,"---",$12}') >file
  • AskUbuntu does not support asking a second question in a comment.
    – waltinator
    Aug 17, 2017 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.