watch
For example every 5 second, I want to print out the time then save the time into the a txt file
$watch -n5 'echo `date +%T` >> hello.txt'
# then you can see the output by using
$ tail -f hello.txt
For example every 5 second, I want to print out the time then save the time into the a txt file
$watch -n5 'echo `date +%T` >> hello.txt'
# then you can see the output by using
$ tail -f hello.txt