Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the command which continuosly outputs something on the screen of putty like we have when we install something.

Now that process is very long and its going to take many hours. I have few questions

  1. How can i output the data in text file not on screen. i tried comand > my.txt but it display on screen not in that file

  2. Is there any way that if the file length or size increases then all previous data is emptied so that i can have only few pages only

share|improve this question
Is it possible that you are trying to log error messages? Try 2> instead of > then. – Baarn Dec 20 '12 at 7:33
they are different level of messages like DEBUG , warning error , critical as per application – user1721949 Dec 20 '12 at 7:37
You should give more information about the specific programs that don't work as expected. Does > work normally? You should also split the question as the first one is totally unrelated to the second one. – Baarn Dec 20 '12 at 7:54
up vote 3 down vote accepted

The classic solution is

  nohup command > my.txt 2>&1 &

then logout.
Sometime later, to see how it is getting on

  tail -f my.txt
share|improve this answer

Incase if you want your logfile to be rotated periodically based on size you can use "logrotate". It can compress, rotate and even send you the compressed logs via email.

also if you are interested in doing things more perfectly use "logger" (syslog tool) for logging.

logger + logrotate is a good combination for handling logs..

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .