IRB.conf[:AUTO_INDENT] = true
IRB.conf[:USE_READLINE] = true
IRB.conf[:LOAD_MODULES] =  unless IRB.conf.key?(:LOAD_MODULES)
IRB.conf[:LOAD_MODULES] << 'irb/completion'
Now, when you are typing commands into IRB, you can hit the “tab” key and it will automatically complete the command for you or display a list of possible commands if the prefix is ambiguous.
Note:This tutorial is not my own,its from http://wiki.rubyonrails.org/rails/pages/TipsAndTricks.Thanks to the wiki.rubyrails.org