There are a bunch of shell commands that throw away old output. A couple that I have seen are Nose and Hudson. What I mean is that when the program is run, it produces a lot of textual output in the shell, but when you scroll up, you can't see the old output, only the commands you used before you even typed the original command.

This is driving me crazy, because important information is being swallowed. How do I make these programs stop doing this?


That sort of thing is usually the result of a program which manipulates the terminal directly and moves the cursor around on it's own. For example, that's what editors like vi do - if you try to scroll the shell back after a vi session, you only see the text in the last page of vi output, not anything else you paged through.

Ways to deal with this:

  • Use a tool like screen(1) and enable logging (ctrl-A H). Then you can review the log later. That might show more useful info.
  • Try using tee(1) to capture the output as it goes by with command | tee output.txt
  • Determine how to disable any fancy output mode in the program you are running and force it to spit out plain text.

For that last one there are a few things you can try. First, look at the arguments to the command and see if there's anything like -nostty or anything talking about dumb terminals.

You can also try forcing the program to think it's on a dumb terminal like this:

TERM=dumb command

(assuming bash shell) and that might make the program think it's running on a dumb terminal and cause it to switch back to straight text output.

You can also try feeding the program some input and that might trigger it's simple text output mode:

echo blarg | command

or maybe

echo blargh | command -

if the program takes - as an indication to read from stdin.

Anyway, experiment with those ideas and you should find some way to get straight text output from the tools you are using.

  • I'm already a screen user, so I tried that; But the hardcopy.0 file remains empty. Possibly there is a stderr/stdout confusion? – Ram Rachum Jan 21 '11 at 10:25
  • I also tried TERM=dumb, didn't work. – Ram Rachum Jan 21 '11 at 10:25
  • command </dev/null is another idea. Also, look to see if the program docs make reference to the termcap ti and te capabilities (terminfo smcup and rmcup). Changing those may be of some help. – Dennis Williamson Jan 21 '11 at 10:40

The method that worked for me is doing this:

my_command my_args >log 2>&1

Which stores all output in a file called log.

Then, in a separate shell window, I do this:

tail -f log

Which shows the log file as my_command is writing into it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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