Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-29-2010, 06:54 AM   #1
Registered: Nov 2009
Posts: 48

Rep: Reputation: 18
how do I send output to both the screen and a txt file

I am currently using this command

apt-get install samba --force-yes -y > /sambainstall.txt
This suppresses the screen output and sends it all to a text file, how do I have both?
Old 01-29-2010, 06:57 AM   #2
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,037

Rep: Reputation: 1407Reputation: 1407Reputation: 1407Reputation: 1407Reputation: 1407Reputation: 1407Reputation: 1407Reputation: 1407Reputation: 1407Reputation: 1407
Use the tee command.
apt-get install samba --force-yes -y | tee sambainstall.txt
See the man page for details



Last edited by evo2; 01-29-2010 at 06:58 AM. Reason: example
Old 01-29-2010, 07:14 AM   #3
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,577
Blog Entries: 31

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
If apt-get may output to stderr as well as stdout you need to add 2>&1 at the end of the apt-get command.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
IS it possible to send command output to a file as well as the screen helptonewbie Programming 6 09-16-2007 02:13 PM
How to read HTML or TXT file and output the data? koolkicks311 Programming 1 04-21-2007 12:13 AM
How can I send mails to multiple addresses in a txt file will824 Linux - Software 8 09-14-2006 11:26 PM
using commands to output path, filename and info to a txt file bob_man_uk Linux - General 3 05-11-2006 03:31 PM
Can not send cron output to the screen tryingHarder Linux - Newbie 3 09-26-2004 11:11 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:45 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration