1

Let us say I submit a process in the background and I want to see the stdout and stderr. In another post it was suggested:

command > logfile 2>&1 &

But when I do head logfile I do not see anything? Is it not real time? if not, is there anyway to print to the logfile real time?

1

See this question on SO. Your problem is that writes to the file are being buffered and you need to tell them to be unbuffered to so you can see them in "real time".

The best answer there is to use the unbuffer script which is installed by the expect package on your system:

unbuffer command > logfile 2>&1 &
| improve this answer | |
  • thanks. my system does not have the unbuffer commmand... is there any other way? I also have a bash shell and no tcl... worse case I could ask the unix admins to install it but I am also not an admin of the system... – Dnaiel Dec 27 '13 at 19:06
  • If the admins won't install expect you could compile it yourself and install it to ~/bin. – casey Dec 27 '13 at 19:17

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.