LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
Search this Thread
Old 01-29-2010, 05:54 AM   #1
replica88
Member
 
Registered: Nov 2009
Posts: 48

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


I am currently using this command

Code:
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, 05:57 AM   #2
evo2
Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,434

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

Cheers,

Evo2.

Last edited by evo2; 01-29-2010 at 05:58 AM. Reason: example
 
Old 01-29-2010, 06:14 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,551
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
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.
 
  


Reply


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 01:13 PM
How to read HTML or TXT file and output the data? koolkicks311 Programming 1 04-20-2007 11:13 PM
How can I send mails to multiple addresses in a txt file will824 Linux - Software 8 09-14-2006 10:26 PM
using commands to output path, filename and info to a txt file bob_man_uk Linux - General 3 05-11-2006 02:31 PM
Can not send cron output to the screen tryingHarder Linux - Newbie 3 09-26-2004 10:11 PM


All times are GMT -5. The time now is 11:30 PM.

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