Command Line Options (GNU Octave (version 10.3.0))

#### 2.1.1 Command Line Options ¶

Here is a complete list of the command line options that Octave accepts.

`--built-in-docstrings-file filename` ¶

  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 be specified in extraordinary situations.

`--doc-cache-file filename` ¶

  Specify the name of the documentation cache file to use. The value of filename specified on the command line will override any value of `OCTAVE_DOC_CACHE_FILE` found in the environment, but not any commands in the system or user startup files that use the `doc_cache_file` function.

`--echo-commands` ¶
`-x`

  Echo commands as they are executed.

`--eval code` ¶
`-e code`

  Evaluate code and exit when finished unless `--persist` is also specified.

`--exec-path path` ¶

  Specify the path to search for programs to run. The value of path specified on the command line will override any value of `OCTAVE_EXEC_PATH` found in the environment, but not any commands in the system or user startup files that call the `EXEC_PATH` function.

`--gui` ¶
`-g`

  Start the graphical user interface (GUI).

`--help` ¶
`-h`

  Print short help message and exit.

`--image-path path` ¶

  Add path to the head of the search path for images. The value of path specified on the command line will override any value of `OCTAVE_IMAGE_PATH` found in the environment, but not any commands in the system or user startup files that call the `IMAGE_PATH` function.

`--info-file filename` ¶

  Specify the name of the info file to use. The value of filename specified on the command line will override any value of `OCTAVE_INFO_FILE` found in the environment, but not any commands in the system or user startup files that use the `info_file` function.

`--info-program program` ¶

  Specify the name of the info program to use. The value of program specified on the command line will override any value of `OCTAVE_INFO_PROGRAM` found in the environment, but not any commands in the system or user startup files that use the `info_program` function.

`--init-trace` ¶

  Print the name of each configuration as it is read and executed during initialization.

`--interactive` ¶
`-i`

  Force interactive behavior. This can be useful for running Octave via a remote shell command or inside an Emacs shell buffer.

`--line-editing` ¶

  Force readline use for command-line editing.

`--no-gui` ¶
`-G`

  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 `--gui`.

`--no-history` ¶
`-H`

  Disable recording of command-line history.

`--no-init-all` ¶
`--norc`
`-f`

  Don’t read any of the system or user initialization files at startup. This is equivalent to using both of the options `--no-site-file` and `--no-init-user`.

`--no-init-path` ¶

  Don’t initialize the search path for function files to include default locations.

`--no-init-site` ¶

  Don’t read the site-wide `octaverc` initialization files.

`--no-init-user` ¶

  Don’t read the user initialization files `~/.octaverc` and `.octaverc`.

`--no-line-editing` ¶

  Disable command-line editing.

`--no-window-system` ¶
`-W`

  Disable use of a windowing system including graphics. This forces a strictly terminal-only environment.

`--path path` ¶
`-p path`

  Add path to the head of the search path for function files. The value of path specified on the command line will override any value of `OCTAVE_PATH` 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.

`--persist` ¶

  Go to interactive mode after `--eval` or reading from a file named on the command line.

`--quiet` ¶
`--silent`
`-q`

  Don’t print the usual greeting and version message at startup.

`--texi-macros-file filename` ¶

  Specify the name of the file containing Texinfo macros for use by makeinfo.

`--traditional` ¶
`--braindead`

  For compatibility with MATLAB, set initial values for user preferences to the following values

      PS1                             = ">> "
      PS2                             = ""
      PS4                             = ""
      beep_on_error                   = true
      confirm_recursive_rmdir         = false
      crash_dumps_octave_core         = false
      optimize_diagonal_matrix        = false
      optimize_permutation_matrix     = false
      optimize_range                  = false
      fixed_point_format              = true
      history_timestamp_format_string = "%%-- %D %I:%M %p --%%"
      print_empty_dimensions          = false
      print_struct_array_contents     = true
      save_default_options            = "-mat-binary"
      struct_levels_to_print          = 0

  and disable the following warnings

      Octave:abbreviated-property-match
      Octave:colon-nonscalar-argument
      Octave:data-file-in-path
      Octave:empty-index
      Octave:function-name-clash
      Octave:possible-matlab-short-circuit-operator

  Note that this does not enable the `Octave:language-extension` warning, which you might want if you want to be told about writing code that works in Octave but not MATLAB (see warning, warning_ids).

`--version` ¶
`-v`

  Print the program version number and exit.

`file`

  Execute commands from file. Exit when done unless `--persist` is also specified.

Octave also includes several functions which return information about the command line, including the number of arguments and all of the options.

`args =` argv `()` ¶

  Return the command line arguments passed to Octave.

  For example, if you invoked Octave using the command

      octave --no-line-editing --quiet

  `argv` would return a cell array of strings with the elements `--no-line-editing` and `--quiet`.

  If you write an executable Octave script, `argv` will return the list of arguments passed to the script. See Executable Octave Programs, for an example of how to create an executable Octave script.

  See also: program_name, cmdline_options.

`opt_struct =` cmdline_options `()` ¶

  Return a structure containing detailed information about the command line arguments passed to Octave.

  Programming Note: This function provides copious amounts of information about Octave’s parsing of command line options and may be more useful for debugging Octave rather than for general use.

  See also: argv, program_name.

`name =` program_name `()` ¶

  Return the filename component of the value returned by `program_invocation_name`.

  See also: program_invocation_name, argv.

`name =` program_invocation_name `()` ¶

  Return the string that was typed at the shell prompt to run Octave.

  The string may include path components as well as the program filename.

  If executing a script from the command line (e.g., `octave foo.m`) or using an executable Octave script, the program name is set to the name of the script. See Executable Octave Programs, for an example of how to create an executable Octave script.

  See also: program_name, argv.

Here is an example of using these functions to reproduce the command line which invoked Octave.

    printf ("%s", program_name ());
    arg_list = argv ();
    for i = 1:nargin
      printf (" %s", arg_list{i});
    endfor
    printf ("\n");

See Indexing Cell Arrays, for an explanation of how to retrieve objects from cell arrays, and Defining Functions, for information about the variable `nargin`.