11

I am Ruby on Rails developer. I have run a Ruby on Rails server in the terminal window. Ruby on Rails outputs log information into the terminal windows. But due to the long log, the first log lines are inaccessible for me through window scrolling.

How could I increase the number of lines shown in the terminal window?

Enter image description here

3 Answers 3

19

Click EditProfilesScrolling. Then increase the value under limit scrollback to: or untick it to allow scrolling through unlimited lines.

Terminal Preferences

From comment by Kevin: Be careful with unchecking that option. If a program goes crazy and spews lots of data onto your terminal, you could have memory issues.

4
  • or just untick? Jun 4, 2015 at 16:48
  • 4
    Be careful with unchecking that option entirely. If a program goes crazy and spews lots of data onto your terminal, you could have memory issues.
    – Kevin
    Jun 4, 2015 at 20:39
  • Good advice. Have some upvotes @Kevin :D But I never mentioned unticking >:-D A.B did >:D
    – Rinzwind
    Jun 5, 2015 at 6:34
  • Good advice, but can this also be done from command line. This advice is not possible for me, since I do not have a desktop (I am running Ubuntu 18.04 LTS as a windows subsystem for linux, wsl).
    – patrik
    Nov 16, 2018 at 14:39
7

Open the profile settings for the terminal via

Edit > Profile Settings.

Or with a right click in the terminal:

Profile > Profile Settings

Change the value for Limit scrollback or remove the mark for unlimited scrolling.

1
  • 1
    Mine got a picture >:-D
    – Rinzwind
    Jun 4, 2015 at 12:35
2

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

You must log in to answer this question.

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