Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Linux - I am redirecting a command to a file, but I also want to see the output on the screen

Posted on 2007-12-06
6
Medium Priority
?
269 Views
Last Modified: 2013-12-16
Hi.

I'm running command like this, to redirect output to a file

SomeCommand > outputfile.txt

I would also like to see the output on the screen.

How can I achieve this?

Thank you for your time
0
Comment
Question by:oxygen_728
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 7

Assisted Solution

by:killbrad
killbrad earned 200 total points
ID: 20422451
SomeCommand > outputfile.txt && cat outputfile.txt
0
 
LVL 22

Accepted Solution

by:
robocat earned 1600 total points
ID: 20422459

From another terminal, you can start a

tail -f outputfile.txt

Another interesting way to do this is using the "tee" command

SomeCommand | tee outputfile.txt

The tee command will send the output to the screen and to the file

0
 
LVL 5

Assisted Solution

by:sardiskan
sardiskan earned 200 total points
ID: 20422473
There are some fancy scripting techniques you can use to do that, but if you are looking for a command line answer, and you don't need to see the output AS it happens, I'd do this:
# somecmd > outputfile.txt && cat outputfile.txt

Open in new window

0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Closing Comment

by:oxygen_728
ID: 31413232
thanks, the tee command looks great
0
 
LVL 7

Expert Comment

by:broeckske
ID: 20422564
you can use the  "tee" command  

like this:

somecommand | tee outputfile.txt

0
 
LVL 7

Expert Comment

by:killbrad
ID: 20422639
Thanks for that info about tee command.. wasn't aware of that.. good show!  :-)
0

Featured Post

How Blockchain Is Impacting Every Industry

Blockchain expert Alex Tapscott talks to Acronis VP Frank Jablonski about this revolutionary technology and how it's making inroads into other industries and facets of everyday life.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question