LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   saving to file (https://www.linuxquestions.org/questions/linux-newbie-8/saving-to-file-520927/)

ashishjen 01-19-2007 12:01 PM

saving to file
 
when we install some package then their are some commands which are shown on the console but we cant see all of them when they are more than a limit. i wanted to know that how can we save th efull info which has been displayed without loosing even a single word...

pixellany 01-19-2007 12:13 PM

Redirection is your friend....

When you run any Linux command, you can redirect any output to a file. You will want to read up on this, because some options are not intuitively obvious.

Simple example:
Read a file named "stuff" and put the output in a new file named "mystuff":
cat stuff >mystuff

when you run certain commands you can have normal output + error messages. Te be sure that it ALL goes to a file, you need to redirect the "stderr" stream also--like so
cat stuff >mystuff 2>myerrors
There are also ways to get stdout and stderr to go to one file

The book I recommend for this kind of thing is the Bash Guide for Beginners, by Machtelt Garrels. It is at tldp.org

Tinkster 01-19-2007 03:28 PM

Alternatively a pipe into tee is a good choice, too. Lets you
eat the cake AND have it :}

command 2>&1 | tee output.txt



Cheers,
Tink

ashishjen 01-22-2007 10:49 AM

as said above i am not able to see the progress on the terminal . i actually want that along with display on screen i can get redirection also..

any idea's....

Tinkster 01-22-2007 11:31 AM

I highly recommend re-reading my previous post.

As I said above: tee does exactly that.


Cheers,
Tink


All times are GMT -5. The time now is 02:21 AM.