Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When in freebsd you install any software using

cd /usr/ports/mysql56-server
make install

It produces a lot of output on the screen.

How you can read that output latter in a file.

I tried

cd /usr/ports/mysql56-server
make install > /home/mysql.install.log

BUT IT FAILED -( ........... Any Suggestion??

share|improve this question

4 Answers 4

Try this:

cd /usr/ports/mysql56-server
make install > /home/mysql.install.log 2>&1

Probably, some ouputs is printed to stdout, some to stderr. So you can save all outputs by redirect stderr to stdout, then write stdout to a file.

You can also use tee command:

make install 2>&1 | tee /home/mysql.install.log

n.b. The stderr redirection is still necessary for pipes.

@Nishan

If you use csh, try this:

make install >& /home/mysql.install.log
share|improve this answer
    
I'm sorry to say both give Ambiguous Output Redirect. –  Nishan Mar 10 at 6:38
    
Ah, maybe you use csh? –  cuonglm Mar 10 at 6:48
    
Great Working UPDATED SOLUTION +1 –  Nishan Mar 10 at 7:04

Have a look at man script. ;) Basically, you do script somefile.txt, and it will open a new shell where everything that happens gets written to somefile.txt (exit to quit).

share|improve this answer

The output you are referring to is being printed to standard error, not standard output. To capture stderr, you need 2>:

make install 2> /home/mysql.install.log
share|improve this answer
    
It only record error messages. –  Mohsen Pahlevanzadeh Mar 9 at 17:32
1  
@MohsenPahlevanzadeh thank you, I know. That's what I'm saying in my answer (and that's why I upvoted Gnouc's answer and will upvote yours now that Gnouc corrected it). In any case, the OP already redirected stdout and claimed it failed so presumably, they wanted stderr. Either way, please don't downvote answers unless they are actually wrong. –  terdon Mar 9 at 17:39
    
Wow, Realy sorry, i didn't read its post completly. –  Mohsen Pahlevanzadeh Mar 9 at 17:41
    
This did what what requested but with error but it converted my /home directory into file. WHERE HAS GONE MY _/home_ DIRECTORY -(` –  Nishan Mar 10 at 6:51
    
@Nishan huh? Did you maybe leave a space between /home/ and mysql.install.log? –  terdon Mar 10 at 15:17
make install > /home/mysql.install.log 2>&1

0 == stdin

1 == stdout

2 == stderr

default == 1

share|improve this answer
1  
0 is stdin, 1 is stdout. –  cuonglm Mar 9 at 17:33
    
Thanks , i upgraded. –  Mohsen Pahlevanzadeh Mar 9 at 17:38
    
I'm sorry that give Ambiguous Output Redirect. –  Nishan Mar 10 at 6:58
    
What's your shell? –  Mohsen Pahlevanzadeh Mar 10 at 17:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.