Outputting command to a text file

Haulmark, Chris chris at sigd.net
Thu Nov 11 19:18:10 GMT 2004


Someone broke the silence: 

> I want to use the du command to check on the sizes of files in a
> directory, but i want the output to be put into a text file so I can
> look at it later. 
>

Use the character > at the end of your command to redirect it to wherever you want.

For example,  if I was to want the output of du results to a file named du.log in the /home/chris directory, I would do this:

du -d 1 -h / > /home/chris/du.log

If I wanted to do it again but to have it added at the end of du.log.  I would use two >>.

du -d 1 -h / >> /home/chris/du.og

Remember, if you use one >, you will wipe out the original results and replace it with the newer results.

Files are not the only thing you can usually use after the > character.

 
> I did some search on google, and found nothing that applied.
> Searched other places (lists and things) and couldn't find what i was
> looking for, perhaps i was using the wrong search terms.
> 
> Any help will be greatly appreciated
> 
> Thanks
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe at freebsd.org"

--
Chris Haulmark
System Admin. Freelancer
"In market for IT corrections for a salary."


More information about the freebsd-questions mailing list