# Irb's readline history

**URL:** <https://www.ruby-forum.com/t/irbs-readline-history/135653>\
**Category:** Ruby\
**Created:** [April 23, 2008, 10:01pm UTC](https://www.ruby-forum.com/t/irbs-readline-history/135653 "2008-04-23T22:01:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![alby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@alby](https://www.ruby-forum.com/u/alby)\
**Post date:** [April 23, 2008, 10:01pm UTC](https://www.ruby-forum.com/t/irbs-readline-history/135653/1 "2008-04-23T22:01:01Z")

</div>

irb is nice, because is uses readline. I can press to bring to  
life previously typed lines. That’s good. But if I exist irb and then  
return to it the history is gone. So it’s not like bash(1) and mysql(1)  
that save the history is a file. Or is it? Is it possible to make irb  
save the history in a file so that I don’t have to retype everything if  
I restart it?

---

<div class="post-metadata">

**Author:** ![alby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@alby](https://www.ruby-forum.com/u/alby)\
**Post date:** [April 23, 2008, 10:02pm UTC](https://www.ruby-forum.com/t/irbs-readline-history/135653/2 "2008-04-23T22:02:23Z")

</div>

> But if I exist irb and then return to it […]

I meant: “if I exit”. Not “if I exist”. Sorry about the spam.

---

<div class="post-metadata">

**Author:** ![alby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@alby](https://www.ruby-forum.com/u/alby)\
**Post date:** [April 23, 2008, 10:13pm UTC](https://www.ruby-forum.com/t/irbs-readline-history/135653/3 "2008-04-23T22:13:13Z")

</div>

On Wed, Apr 23, 2008 at 4:01 PM, Albert S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> irb is nice, because is uses readline. I can press to bring to  
> life previously typed lines. That’s good. But if I exist irb and then  
> return to it the history is gone. So it’s not like bash(1) and mysql(1)  
> that save the history is a file. Or is it? Is it possible to make irb  
> save the history in a file so that I don’t have to retype everything if  
> I restart it?

Yes.

Utility Belt ([http://utilitybelt.rubyforge.org/](http://utilitybelt.rubyforge.org/)) enables this and many  
other tweaks.

–  
Avdi

Home: [http://avdi.org](http://avdi.org)  
Developer Blog: [Avdi Grimm, Code Cleric](http://avdi.org/devblog/)  
Twitter: [http://twitter.com/avdi](http://twitter.com/avdi)  
Journal: [http://avdi.livejournal.com](http://avdi.livejournal.com)

---

<div class="post-metadata">

**Author:** ![alby](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/85f322/32.png) [@alby](https://www.ruby-forum.com/u/alby)\
**Post date:** [April 23, 2008, 10:23pm UTC](https://www.ruby-forum.com/t/irbs-readline-history/135653/4 "2008-04-23T22:23:14Z")

</div>

Albert S. wrote:

> irb is nice, because is uses readline. I can press to bring to  
> life previously typed lines. That’s good. But if I exist irb and then  
> return to it the history is gone. So it’s not like bash(1) and mysql(1)  
> that save the history is a file. Or is it? Is it possible to make irb  
> save the history in a file so that I don’t have to retype everything if  
> I restart it?

Put this in your .irbrc:

IRB.conf[:SAVE\_HISTORY] = 100
