set [options arg1 arg2 ...]

With no arguments, set prints the values of all variables known to the current shell. Options can be enabled (-option) or disabled (+option). Options can also be set when the shell is invoked. (See the section Invoking the Shell in Invoking the Shell.) Arguments are assigned in order to $1, $2, etc.



From now on, automatically mark variables for export after defining or changing them.


Print job completion messages as soon as jobs terminate; don’t wait until the next prompt.


Enable brace expansion. On by default.


Prevent overwriting via > redirection; use >| to overwrite files.


Exit if a command yields a nonzero exit status. The ERR trap executes before the shell exits.


Cause shell functions, command substitutions, and subshells to inherit the ERR trap.


Ignore filename metacharacters (e.g., * ? [ ]).


Locate and remember commands as they are defined. On by default.


Enable csh-style (!-style) history substitution. On by default.


Assignment of environment variables (var=value) takes effect regardless of where they appear on the command line. Normally, assignments must precede the command name.


Enable job control; background jobs execute in a separate process group. -m is usually on by default.


Read commands but don’t execute; useful for checking syntax. Ignored if the shell is interactive.

+o [mode]

With mode, disable the given shell option. Plain set +o prints the settings of all the current options in a form that can be reread ...

Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.