Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8191127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:51:05+00:00 2026-06-07T03:51:05+00:00

There are plenty of threads here discussing how to do this for scripts or

  • 0

There are plenty of threads here discussing how to do this for scripts or for the cmdline (mostly involving pipes, redirections, tee).
What I didn’t find is a solution which can be set up once and then just works globally, without manipulating single scripts or adding something to every command line.

What I want to achieve is something like described in the top answer of
How do I write stderr to a file while using "tee" with a pipe?

Isn’t it possible to configure the bash session so that all stderr output is logged to a file, while still writing it to console? Something I could add to .bashrc and thus automatically set up every time I login?

Software: Bash 4.2.24(1)-release (x86_64-pc-linux-gnu), xterm, Ubuntu 12.04

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T03:51:05+00:00Added an answer on June 7, 2026 at 3:51 am

    Try this variation on @0xC0000022L’s previous solution (put it in your .bash_profile):

    exec 2> >( tee log.file > /dev/tty )
    

    A couple of caveats:

    1. The prompt and anything you type at the command line are printed to stderr, and so will be logged in your file.

    2. There could be an issue with the newline that terminates a command not being displayed in your terminal; I observe it on my Linux host, but not on my Mac OS X laptop. Perhaps someone else can explain and/or fix the issue. For example, if I type “echo stdout”, I see the following:

      $ echo stdoutstdout
      $
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are plenty of threads explaining what Doctype to choose, but I can't find
I know there's already plenty of threads that start off this way. I'm reading
There are plenty of 'pretty-printing' visualization libraries for Javascript. E.g. those listed here. Googling
Is this good practice? Storing objects accessed by a constant. There are plenty of
I know there are plenty of questions regarding this error, but I haven't found
there probably plenty of you here who have done secure payment forms in their
There is plenty of discussion for this regarding https. But do the headers get
There are plenty of questions on here related to fork() and exec(). I have
There are plenty of threads on how to create a Method using Reflection.Emit but
There are plenty of examples of sending data to SugarCRM via a web-service, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.