Thinking about this in a different way, you could also redirect the output to a file and then use less +F
to stream the file into less
. Pressing ctrl + c
will stop the stream, and typing shift + f
will continue the stream.
This also gives you the added benefit of being able to highlight things you care about. For example, typing /my_search_term
(forward-search) or ?my_search_term
(backward-search) will also highlight my_search_term
in the file. This highlighting will continue as new data streams in.
How do I output to a file?
There are a couple of options, but for completeness, this may be best:
start_rails_server &>> my_new_logfile
The &>
will pipe both the stdout and stderr to the log file. (You can pick one or the other by using a number, 1
for stdout and 2
for stderr, though stdout is implicit so you could just do cmd > file
and you would get stdout printed to your file.)
The angle bracket sends the output to my_new_logfile
, and the fact that there are two means that it will append to the file if it exists, and create a new one if not. If you used a single angle bracket, then any existing file would be overwritten:
start_rails_server &> my_new_logfile