Tag Archives: Top batch mode

Shell scripting Interview questions

Hey Guys n Gals,

I m back after a long time, work work work…..I have started to write small articles help full to others and this one is shell scripting interview questions.

So here goes

This was asked at Capgemini

How will you save the output of the TOP command in a file?

Use  Top in batch mode

# top -b -n1 > filename.txt

The -b option is for batch mode and the -n option is for the number of iterations in this case 1.

You can use the -d to option to to specify the time between two iterations

# top -b -n1 -d10 > filename.txt

The delay is 10 seconds


Tags: , ,

%d bloggers like this: