df -k output to a file

Hi there, I am new to scripting, can someone show me how to send the output of df -k on multiple server to a file under /tmp, thanks

You can redirect output to a file by adding a > /tmp/some.out.put to the end of your command line, for example.

Thanks zaxxon, easy enough

Append to an existing file using two greater than signs:

command >> out.txt

A single greater than sign will clear the file before use if the file already exists.

1 Like

thanks Gary