Linux "ruby" Command Line Options and Examples
Interpreted object-oriented scripting language

Ruby is an interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (like in Perl). It is simple, straight-forward, and extensible.


ruby [--copyright] [--version] [-SUacdlnpswvy] [-0[octal]] [-C directory] [-E external[:internal]] [-F[pattern]]
[-I directory] [-K[c]] [-T[level]] [-W[level]] [-e command] [-i[extension]] [-r library] [-x[directory]]
[--{enable|disable}-FEATURE] [--dump=target] [--verbose] [--] [program_file] [argument ...]

Command Line Options:

Prints the copyright notice.
ruby --copyright ...
Prints the version of Ruby interpreter.
ruby --version ...
directory Causes Ruby to switch to the directory.
ruby -X ...
ruby -E ...
Specifies the default value(s) for external encodings and internal encoding. Values should beseparated with colon (:).You can omit the one for internal encodings, then the value (Encoding.default_internal) will benil.
ruby --encoding ...
Specify the default external or internal character encoding
ruby --internal-encoding ...
pattern Specifies input field separator ($;).
ruby -F ...
Turns on taint checks at the specified level (default 1).
ruby -T[level ...
Sets the default value for internal encodings (Encoding.default_internal) to UTF-8.
ruby -U ...
$F = $_.splitat beginning of each loop.
ruby -a ...
Turns on debug mode. $DEBUG will be set to true.
ruby --debug ...
Prints a summary of the options.
ruby --help ...
library Causes Ruby to load the library using require. It is useful when using -n or -p.
ruby -r ...
Turns on compiler debug mode. Ruby will print a bunch of internal state messages during compila‐tion. Only specify this switch you are going to debug the Ruby interpreter.
ruby --yydebug ...
Disables (or enables) the specified FEATURE.
ruby --enable-FEATURE ...
est version of each installed gem. The Gem constant is true if RubyGems isenabled, false if otherwise.
ruby --enable-gems ...
siders the variable.
ruby --enable-rubyopt ...
Disables (or enables) all features.
ruby --enable-all ...
Prints the specified target. target can be one of;version version description same as --versionusage brief usage message same as -hhelp Show long help message same as --helpsyntax check of syntax same as -c --yydebugyydebug compiler debug mode, same as --yydebugOnly specify this switch if you are going to debug the Ruby interpreter.parsetreeparsetree_with_comment AST nodes treeOnly specify this switch if you are going to debug the Ruby interpreter.insns disassembled instructionsOnly specify this switch if you are going to debug the Ruby interpreter.
ruby --dump=target ...