Review your favorite Linux distribution.
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 07-01-2003, 12:50 PM   #1
Registered: Jun 2002
Distribution: RH, FC, FreeBSD,OpenBSD
Posts: 326

Rep: Reputation: 30
Putting error messages on the screen into a file...

Well, hopefully this will be a simple question here. It seems this morning im having a major brain fart and cant remember how to do a bunch of things.

Here is what I'm doing. Im working with samba 3.0 beta to do some preliminary testing. However, im running into a few snags when trying to mount certain things and use some of the new features...When this happens, it kicks out errors onto the screen and gives me some codes and things to check.

What i'd like to do is put these error messages into a file and keep them handy.

I've tried the tee command, for example:

samba command to mount share blah blah blah | tee > error.log

Hoping that this would kick out the errors to my log. But it's not.

So the next thing Im trying to do is somehow copy the messages off the screen and kick them to another file.
Even if I have to type the full message, how can I put it into a file without opening up a text editor...

What I mean is: Can I type the message and then somehow use cat to put it into a file?

cat error message, blah blah > error.log

ANy ideas?


Old 07-01-2003, 12:53 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you're just not redirecting the right stream...

command 2> log

will capture the stderr stream rather than stdout
Old 07-01-2003, 01:14 PM   #3
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Remember you can log both stderr and stdout using:
command 2>&1 > log
Old 07-01-2003, 02:01 PM   #4
Registered: Jun 2002
Distribution: RH, FC, FreeBSD,OpenBSD
Posts: 326

Original Poster
Rep: Reputation: 30
Thanks guys.

Do you know if that can be run in conjunction with smbmount?

For example:

smbmount //server/share /mnt/samba -o username=admin 2>&1> log

Reason I ask is that I know, if I run a command very similiar to the one above (with -o username) I will be prompted for a password. Will that have any effect on the output of the error?

Thanks guys.



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
Redirecting the kernel messages to file other than /var/log/messages jyotika_b83 Linux - General 3 04-28-2005 06:39 PM
Redirecting error messages to stderr and file in Bash lowpro2k3 Programming 1 04-14-2005 06:47 PM
HOSTS file and error messages cadj Linux - Networking 6 12-14-2004 08:59 AM
Error messages on my screen Wimpie22 Linux - General 1 08-02-2004 04:35 PM
convert error messages to text file creilar Linux - Newbie 1 05-26-2004 10:58 AM > Forums > Linux Forums > Linux - Newbie

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

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
Open Source Consulting | Domain Registration