<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ --> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Command Line Options (GNU Octave (version 5.1.0))</title> <meta name="description" content="Command Line Options (GNU Octave (version 5.1.0))"> <meta name="keywords" content="Command Line Options (GNU Octave (version 5.1.0))"> <meta name="resource-type" content="document"> <meta name="distribution" content="global"> <meta name="Generator" content="makeinfo"> <link href="index.html#Top" rel="start" title="Top"> <link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index"> <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <link href="Invoking-Octave-from-the-Command-Line.html#Invoking-Octave-from-the-Command-Line" rel="up" title="Invoking Octave from the Command Line"> <link href="Startup-Files.html#Startup-Files" rel="next" title="Startup Files"> <link href="Invoking-Octave-from-the-Command-Line.html#Invoking-Octave-from-the-Command-Line" rel="prev" title="Invoking Octave from the Command Line"> <style type="text/css"> <!-- a.summary-letter {text-decoration: none} blockquote.indentedblock {margin-right: 0em} blockquote.smallindentedblock {margin-right: 0em; font-size: smaller} blockquote.smallquotation {font-size: smaller} div.display {margin-left: 3.2em} div.example {margin-left: 3.2em} div.lisp {margin-left: 3.2em} div.smalldisplay {margin-left: 3.2em} div.smallexample {margin-left: 3.2em} div.smalllisp {margin-left: 3.2em} kbd {font-style: oblique} pre.display {font-family: inherit} pre.format {font-family: inherit} pre.menu-comment {font-family: serif} pre.menu-preformatted {font-family: serif} pre.smalldisplay {font-family: inherit; font-size: smaller} pre.smallexample {font-size: smaller} pre.smallformat {font-family: inherit; font-size: smaller} pre.smalllisp {font-size: smaller} span.nolinebreak {white-space: nowrap} span.roman {font-family: initial; font-weight: normal} span.sansserif {font-family: sans-serif; font-weight: normal} ul.no-bullet {list-style: none} --> </style> <link rel="stylesheet" type="text/css" href="octave.css"> </head> <body lang="en"> <a name="Command-Line-Options"></a> <div class="header"> <p> Next: <a href="Startup-Files.html#Startup-Files" accesskey="n" rel="next">Startup Files</a>, Up: <a href="Invoking-Octave-from-the-Command-Line.html#Invoking-Octave-from-the-Command-Line" accesskey="u" rel="up">Invoking Octave from the Command Line</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> </div> <hr> <a name="Command-Line-Options-1"></a> <h4 class="subsection">2.1.1 Command Line Options</h4> <a name="index-Octave-command-options"></a> <a name="index-command-options"></a> <a name="index-options_002c-Octave-command"></a> <p>Here is a complete list of the command line options that Octave accepts. </p> <dl compact="compact"> <dt><code>--built-in-docstrings-file <var>filename</var></code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dbuilt_002din_002ddocstrings_002dfile--_002d_002dbuilt_002din_002ddocstrings_002dfile-filename"></a> <p>Specify the name of the file containing documentation strings for the built-in functions of Octave. This value is normally correct and should only need to specified in extraordinary situations. </p> </dd> <dt><code>--debug</code></dt> <dt><code>-d</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002ddebug--_002d_002ddebug"></a> <a name="index-options_002c-Octave-command-_002dd--_002dd"></a> <p>Enter parser debugging mode. Using this option will cause Octave’s parser to print a lot of information about the commands it reads, and is probably only useful if you are actually trying to debug the parser. </p> </dd> <dt><code>--debug-jit</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002ddebug_002djit--_002d_002ddebug_002djit"></a> <p>Enable JIT compiler debugging and tracing. </p> </dd> <dt><code>--doc-cache-file <var>filename</var></code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002ddoc_002dcache_002dfile--_002d_002ddoc_002dcache_002dfile-filename"></a> <p>Specify the name of the doc cache file to use. The value of <var>filename</var> specified on the command line will override any value of <code><span class="nolinebreak">OCTAVE_DOC_CACHE_FILE</span></code><!-- /@w --> found in the environment, but not any commands in the system or user startup files that use the <code>doc_cache_file</code> function. </p> </dd> <dt><code>--echo-commands</code></dt> <dt><code>-x</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002decho_002dcommands--_002d_002decho_002dcommands"></a> <a name="index-options_002c-Octave-command-_002dx--_002dx"></a> <p>Echo commands as they are executed. </p> </dd> <dt><code>--eval <var>code</var></code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002deval--_002d_002deval-code"></a> <p>Evaluate <var>code</var> and exit when finished unless <samp>--persist</samp> is also specified. </p> </dd> <dt><code>--exec-path <var>path</var></code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dexec_002dpath--_002d_002dexec_002dpath-path"></a> <p>Specify the path to search for programs to run. The value of <var>path</var> specified on the command line will override any value of <code><span class="nolinebreak">OCTAVE_EXEC_PATH</span></code><!-- /@w --> found in the environment, but not any commands in the system or user startup files that set the built-in variable <code><span class="nolinebreak">EXEC_PATH</span></code><!-- /@w -->. </p> </dd> <dt><code>--gui</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dgui--_002d_002dgui"></a> <p>Start the graphical user interface (GUI). </p> </dd> <dt><code>--help</code></dt> <dt><code>-h</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dhelp--_002d_002dhelp"></a> <a name="index-options_002c-Octave-command-_002dh--_002dh"></a> <p>Print short help message and exit. </p> </dd> <dt><code>--image-path <var>path</var></code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dimage_002dpath--_002d_002dimage_002dpath-path"></a> <p>Add path to the head of the search path for images. The value of <var>path</var> specified on the command line will override any value of <code><span class="nolinebreak">OCTAVE_IMAGE_PATH</span></code><!-- /@w --> found in the environment, but not any commands in the system or user startup files that set the built-in variable <code><span class="nolinebreak">IMAGE_PATH</span></code><!-- /@w -->. </p> </dd> <dt><code>--info-file <var>filename</var></code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dinfo_002dfile--_002d_002dinfo_002dfile-filename"></a> <p>Specify the name of the info file to use. The value of <var>filename</var> specified on the command line will override any value of <code><span class="nolinebreak">OCTAVE_INFO_FILE</span></code><!-- /@w --> found in the environment, but not any commands in the system or user startup files that use the <code>info_file</code> function. </p> </dd> <dt><code>--info-program <var>program</var></code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dinfo_002dprogram--_002d_002dinfo_002dprogram-program"></a> <p>Specify the name of the info program to use. The value of <var>program</var> specified on the command line will override any value of <code><span class="nolinebreak">OCTAVE_INFO_PROGRAM</span></code><!-- /@w --> found in the environment, but not any commands in the system or user startup files that use the <code>info_program</code> function. </p> </dd> <dt><code>--interactive</code></dt> <dt><code>-i</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dinteractive--_002d_002dinteractive"></a> <a name="index-options_002c-Octave-command-_002di--_002di"></a> <p>Force interactive behavior. This can be useful for running Octave via a remote shell command or inside an Emacs shell buffer. </p> </dd> <dt><code>--jit-compiler</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002djit_002dcompiler--_002d_002djit_002dcompiler"></a> <p>Enable the JIT compiler used for accelerating loops. </p> </dd> <dt><code>--line-editing</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dline_002dediting--_002d_002dline_002dediting"></a> <p>Force readline use for command-line editing. </p> </dd> <dt><code>--no-gui</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dno_002dgui--_002d_002dno_002dgui"></a> <p>Disable the graphical user interface (GUI) and use the command line interface (CLI) instead. This is the default behavior, but this option may be useful to override a previous <samp>--gui</samp>. </p> </dd> <dt><code>--no-history</code></dt> <dt><code>-H</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dno_002dhistory--_002d_002dno_002dhistory"></a> <a name="index-options_002c-Octave-command-_002dH--_002dH"></a> <p>Disable recording of command-line history. </p> </dd> <dt><code>--no-init-file</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dno_002dinit_002dfile--_002d_002dno_002dinit_002dfile"></a> <a name="index-octaverc-_007e_002f_002eoctaverc_007e_002f_002eoctaverc"></a> <a name="index-octaverc-_002eoctaverc_002eoctaverc"></a> <p>Don’t read the initialization files <samp>~/.octaverc</samp> and <samp>.octaverc</samp>. </p> </dd> <dt><code>--no-init-path</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dno_002dinit_002dpath--_002d_002dno_002dinit_002dpath"></a> <p>Don’t initialize the search path for function files to include default locations. </p> </dd> <dt><code>--no-line-editing</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dno_002dline_002dediting--_002d_002dno_002dline_002dediting"></a> <p>Disable command-line editing. </p> </dd> <dt><code>--no-site-file</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dno_002dsite_002dfile--_002d_002dno_002dsite_002dfile"></a> <a name="index-site-startup-file"></a> <p>Don’t read the site-wide <samp>octaverc</samp> initialization files. </p> </dd> <dt><code>--no-window-system</code></dt> <dt><code>-W</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dno_002dwindow_002dsystem--_002d_002dno_002dwindow_002dsystem"></a> <a name="index-options_002c-Octave-command-_002dW--_002dW"></a> <p>Disable use of a windowing system including graphics. This forces a strictly terminal-only environment. </p> </dd> <dt><code>--norc</code></dt> <dt><code>-f</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dnorc--_002d_002dnorc"></a> <a name="index-options_002c-Octave-command-_002df--_002df"></a> <p>Don’t read any of the system or user initialization files at startup. This is equivalent to using both of the options <samp>--no-init-file</samp> and <samp>--no-site-file</samp>. </p> </dd> <dt><code>--path <var>path</var></code></dt> <dt><code>-p <var>path</var></code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dpath--_002d_002dpath-path"></a> <a name="index-options_002c-Octave-command-_002dp--_002dp-path"></a> <p>Add path to the head of the search path for function files. The value of <var>path</var> specified on the command line will override any value of <code><span class="nolinebreak">OCTAVE_PATH</span></code><!-- /@w --> found in the environment, but not any commands in the system or user startup files that set the internal load path through one of the path functions. </p> </dd> <dt><code>--persist</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dpersist--_002d_002dpersist"></a> <p>Go to interactive mode after <samp>--eval</samp> or reading from a file named on the command line. </p> </dd> <dt><code>--silent</code></dt> <dt><code>--quiet</code></dt> <dt><code>-q</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dsilent--_002d_002dsilent"></a> <a name="index-options_002c-Octave-command-_002d_002dquiet--_002d_002dquiet"></a> <a name="index-options_002c-Octave-command-_002dq--_002dq"></a> <p>Don’t print the usual greeting and version message at startup. </p> </dd> <dt><code>--texi-macros-file <var>filename</var></code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dtexi_002dmacros_002dfile--_002d_002dtexi_002dmacros_002dfile-filename"></a> <p>Specify the name of the file containing Texinfo macros for use by makeinfo. </p> </dd> <dt><code>--traditional</code></dt> <dt><code>--braindead</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dtraditional--_002d_002dtraditional"></a> <a name="index-options_002c-Octave-command-_002d_002dbraindead--_002d_002dbraindead"></a> <p>For compatibility with <small>MATLAB</small>, set initial values for user preferences to the following values </p> <div class="example"> <pre class="example">PS1 = ">> " PS2 = "" beep_on_error = true confirm_recursive_rmdir = false crash_dumps_octave_core = false disable_diagonal_matrix = true disable_permutation_matrix = true disable_range = true fixed_point_format = true history_timestamp_format_string = "%%-- %D %I:%M %p --%%" print_empty_dimensions = false save_default_options = "-mat-binary" struct_levels_to_print = 0 </pre></div> <p>and disable the following warnings </p> <div class="example"> <pre class="example">Octave:abbreviated-property-match Octave:data-file-in-path Octave:function-name-clash Octave:possible-matlab-short-circuit-operator </pre></div> <p>Note that this does not enable the <code>Octave:language-extension</code> warning, which you might want if you want to be told about writing code that works in Octave but not <small>MATLAB</small> (see <a href="Issuing-Warnings.html#XREFwarning">warning</a>, <a href="Issuing-Warnings.html#XREFwarning_005fids">warning_ids</a>). </p> </dd> <dt><code>--verbose</code></dt> <dt><code>-V</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dverbose--_002d_002dverbose"></a> <a name="index-options_002c-Octave-command-_002dV--_002dV"></a> <p>Turn on verbose output. </p> </dd> <dt><code>--version</code></dt> <dt><code>-v</code></dt> <dd><a name="index-options_002c-Octave-command-_002d_002dversion--_002d_002dversion"></a> <a name="index-options_002c-Octave-command-_002dv--_002dv"></a> <p>Print the program version number and exit. </p> </dd> <dt><code><var>file</var></code></dt> <dd><p>Execute commands from <var>file</var>. Exit when done unless <samp>--persist</samp> is also specified. </p></dd> </dl> <p>Octave also includes several functions which return information about the command line, including the number of arguments and all of the options. </p> <a name="XREFargv"></a><dl> <dt><a name="index-argv"></a><em></em> <strong>argv</strong> <em>()</em></dt> <dd><p>Return the command line arguments passed to Octave. </p> <p>For example, if you invoked Octave using the command </p> <div class="example"> <pre class="example">octave --no-line-editing --silent </pre></div> <p><code>argv</code> would return a cell array of strings with the elements <samp>--no-line-editing</samp> and <samp>--silent</samp>. </p> <p>If you write an executable Octave script, <code>argv</code> will return the list of arguments passed to the script. See <a href="Executable-Octave-Programs.html#Executable-Octave-Programs">Executable Octave Programs</a>, for an example of how to create an executable Octave script. </p></dd></dl> <a name="XREFprogram_005fname"></a><dl> <dt><a name="index-program_005fname"></a><em></em> <strong>program_name</strong> <em>()</em></dt> <dd><p>Return the last component of the value returned by <code>program_invocation_name</code>. </p> <p><strong>See also:</strong> <a href="#XREFprogram_005finvocation_005fname">program_invocation_name</a>. </p></dd></dl> <a name="XREFprogram_005finvocation_005fname"></a><dl> <dt><a name="index-program_005finvocation_005fname"></a><em></em> <strong>program_invocation_name</strong> <em>()</em></dt> <dd><p>Return the name that was typed at the shell prompt to run Octave. </p> <p>If executing a script from the command line (e.g., <code>octave foo.m</code>) or using an executable Octave script, the program name is set to the name of the script. See <a href="Executable-Octave-Programs.html#Executable-Octave-Programs">Executable Octave Programs</a>, for an example of how to create an executable Octave script. </p> <p><strong>See also:</strong> <a href="#XREFprogram_005fname">program_name</a>. </p></dd></dl> <p>Here is an example of using these functions to reproduce the command line which invoked Octave. </p> <div class="example"> <pre class="example">printf ("%s", program_name ()); arg_list = argv (); for i = 1:nargin printf (" %s", arg_list{i}); endfor printf ("\n"); </pre></div> <p>See <a href="Indexing-Cell-Arrays.html#Indexing-Cell-Arrays">Indexing Cell Arrays</a>, for an explanation of how to retrieve objects from cell arrays, and <a href="Defining-Functions.html#Defining-Functions">Defining Functions</a>, for information about the variable <code>nargin</code>. </p> <hr> <div class="header"> <p> Next: <a href="Startup-Files.html#Startup-Files" accesskey="n" rel="next">Startup Files</a>, Up: <a href="Invoking-Octave-from-the-Command-Line.html#Invoking-Octave-from-the-Command-Line" accesskey="u" rel="up">Invoking Octave from the Command Line</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html#Concept-Index" title="Index" rel="index">Index</a>]</p> </div> </body> </html>