shopt [-opqsu] [options]

Set or unset shell options. With no options or just -p, print the option names and whether they are set or not.



Each option must be one of the shell option names for set -o, instead of the options listed in the next section.


Print the option settings as shopt commands that can be reread later.


Quiet mode. The exit status is zero if the given option is set, nonzero otherwise. With multiple options, all of them must be set for a zero exit status.


Set the given options. With no options, print only those that are set.


Unset the given options. With no options, print only those that are unset.

Settable shell options

The following list describes the behavior when set. Options marked with an asterisk (*) are enabled by default.


Attempt to cd to a directory that is given as a command name. Allowed in interactive shells only.


Treat a nondirectory argument to cd as a variable whose value is the directory to go to.


Attempt spelling correction on each directory component of an argument to cd. Allowed in interactive shells only.


Check that commands found in the hash table still exist before attempting to use them. If not, perform a normal PATH search.


Display the status of any running or stopped jobs before exiting an interactive shell.


Check the window size after each command and update LINES and COLUMNS if the size has changed.

cmdhist *

Save all lines of a multiline command in one history entry. ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.