RSS

Shell scripting Interview questions

07 Dec

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

Advertisements
 
 

Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: