Linux "irb" Command Line Options and Examples
Interactive Ruby Shell

irb is the REPL(read-eval-print loop) environment for Ruby programs..


irb [--version] [-dfm] [-I directory] [-r library] [--[no]inspect] [--[no]readline] [--prompt mode] [--prompt-mode mode]
[--inf-ruby-mode] [--simple-prompt] [--noprompt] [--tracer] [--back-trace-limit n] [--irb_debug n] [--] [program_file]
[argument ...]

Command Line Options:

Prints the version of irb.
irb --version ...
irb -E ...
Same as `ruby -E' . Specifies the default value(s) for external encodings and internal encoding. Values should be sepa‐rated with colon (:).You can omit the one for internal encodings, then the value (Encoding.default_internal) will be nil.
irb --encoding ...
path Same as `ruby -I' . Specifies $LOAD_PATH directory
irb -I ...
Same as `ruby -U' . Sets the default value for internal encodings (Encoding.default_internal) to UTF-8.
irb -U ...
Same as `ruby -d' . Sets $DEBUG to true.
irb -d ...
Suppresses read of ~/.irbrc.
irb -f ...
Prints a summary of the options.
irb --help ...
library Same as `ruby -r'. Causes irb to load the library using require.
irb -r ...
Uses `inspect' for output (default except for bc mode)
irb --inspect ...
Doesn't use inspect for output
irb --noinspect ...
Uses Readline extension module.
irb --readline ...
Doesn't use Readline extension module.
irb --noreadline ...
Switch prompt mode. Pre-defined prompt modes are `default', `simple', `xmp' and `inf-ruby'.
irb --prompt-mode ...
Uses prompt appropriate for inf-ruby-mode on emacs. Suppresses --readline.
irb --inf-ruby-mode ...
Makes prompts simple.
irb --simple-prompt ...
Displays trace for each execution of commands.
irb --tracer ...
Displays backtrace top n and tail n. The default value is 16.
irb --back-trace-limit ...
ENVIRONMENTIRBRCAlso irb depends on same variables as ruby(1).FILES~/.irbrc Personal irb initialization.EXAMPLES% irbirb(main):001:0> 1 + 12irb(main):002:0> def t(x)irb(main):003:1> x+1irb(main):004:1> end=> :tirb(main):005:0> t(3)=> 4irb(main):006:0> if t(3) == 4irb(main):007:1> p :okirb(main):008:1> end:ok=> :okirb(main):009:0> quit%
irb --irb_debug ...