How to view the entire Rails console history?

Viewed 32712

Does anyone know how to view the "history" in the rails console?

Pressing the up arrow lets me iterate through recent commands, but I'd like to see them all together in a list. I'm basically looking for the rails equivalent of the Unix history utility.

Is this possible in rails? If so, how?

6 Answers

The best equivalent to the history command would be

puts Readline::HISTORY.to_a

inside the IRB session. This has the advantage that no filesystem logging to any of the$HOME/.*_history files needs to be configured (as is the case in AWS elastic beanstalk instances).

Try CTRL+R to open the search in the history

We can view it by using following command in console

cat ~/.irb-history
Related