I want to write the output of a specific \'top\' command to a file. I did some googling and find out that it can be done by using the following command.
top
CTRL+C is not a ideal solution due to control stays in CLI. You can use below command which dumps top output to a file:
top -n 1 -b > top-output.txt