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.


Usage:

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:

--copyright
Prints the copyright notice.
ruby --copyright ...
--version
Prints the version of Ruby interpreter.
ruby --version ...
-X
directory Causes Ruby to switch to the directory.
ruby -X ...
-E
external[:internal]
ruby -E ...
--encoding
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 ...
--internal-encoding
Specify the default external or internal character encoding
ruby --internal-encoding ...
-F
pattern Specifies input field separator ($;).
ruby -F ...
-T[level
Turns on taint checks at the specified level (default 1).
ruby -T[level ...
-U
Sets the default value for internal encodings (Encoding.default_internal) to UTF-8.
ruby -U ...
-a
$F = $_.splitat beginning of each loop.
ruby -a ...
--debug
Turns on debug mode. $DEBUG will be set to true.
ruby --debug ...
--help
Prints a summary of the options.
ruby --help ...
-r
library Causes Ruby to load the library using require. It is useful when using -n or -p.
ruby -r ...
--yydebug
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 ...
--enable-FEATURE
Disables (or enables) the specified FEATURE.
ruby --enable-FEATURE ...
--enable-gems
est version of each installed gem. The Gem constant is true if RubyGems isenabled, false if otherwise.
ruby --enable-gems ...
--enable-rubyopt
siders the variable.
ruby --enable-rubyopt ...
--enable-all
Disables (or enables) all features.
ruby --enable-all ...
--dump=target
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 ...