I have an executable that I am running on the Raspberry Pi. When the program is run, output is displayed on the terminal, but when I use the redirect operator >, I get nothing in the text file.

./example > examp.txt

I have also tried using the pipe operator and the tee command but when I do this I get nothing in the text file or on the screen. I am unsure what to try next. The output from the executable is a data stream that is updated every few seconds. I would like to capture a couple updates from the executable in a text file.

./example | tee examp.txt
  • Does the file exist already and is writable by the user executing the executable? With >> you can append text to a file, a single > overwrites the file (so there's a chance that you overwrite the text with a blank line).
    – Foo Bar
    Commented May 27, 2014 at 13:57

1 Answer 1


Your executable might be writing to stderr instead of stdout. So it might be worth trying to redirect stdout, e.g.,

./example 2> stderr.txt > stdout.txt # write stdout and stderr to two different files


./example 2>&1 > log.txt # redirect stderr to stdout and then write them together into one 


Further, your executable might not be writing to either stderr and stdout, e.g., by writing directly to the screen using a library such as curses. In that case, you won't be able to capture its output. It might be worth however to study the executable's documentation if you can give it a command line switch to write to stdout/stderr instead of directly to the screen interactively. An example would be the top command in Linux systems, where you can supply a command line option -b.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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