• Home
  • Shell
    • Emacs
    • Perl
    • screen
    • sed
  • Ubuntu
    • VNC
  • Web Development
    • Javascript
    • Joomla
    • MySQL
    • osTicket
  • Windows
    • Gimp

BASH> Redirect output to standard out AND file

Oct26
2010
Written by Scott Rowley

Eventually in scripting you are likely to want to output to both the screen (standard out) and to a file. This makes it convenient to see whats getting “logged” without needing the extra step of cat’ing the file.

For example:

ls -al | tee ls_al_result.txt

This will give you your normal ‘ls -al’ results but also feed them to your new file.

Posted in BASH - Tagged BASH, ls, redirect, standard out, tee
« BASH> Tail multiple files & highlight
» BASH> Run command from root as another user

Corrections? Questions? Comments?

Find an error?
Everything work out great for you?
Have some feedback?
Like to see something added to the article?

PLEASE leave us a comment after the article and let us know how we are doing, or if something needs corrected, improved or clarified.

Thank you!
- The Management

Advertisement

Sudo Bash
By Geeks - For Geeks

Back to Top