Forrest logo
back to the shopt tool

shopt:tldr:f0639

shopt: List of all settable options and whether they are set.
$ shopt
try on your machine

The "shopt" command is a built-in command in Unix-like operating systems that allows you to change various shell options. These options control the behavior and functionality of the shell.

When you run the "shopt" command without any arguments, it will display the current settings of the shell options. These options include:

  • autocd: If set, this option allows you to change to a directory by simply typing the directory name without using the "cd" command.
  • cdspell: When this option is enabled, the shell will try to correct minor spelling errors when changing directories.
  • globstar: Enables the use of the "**" pattern in globbing, which matches zero or more directories and subdirectories.
  • nocaseglob: When this is set, case-insensitive matching is used in globbing patterns.
  • dotglob: Includes "hidden" files (those starting with a dot) in wildcard expansions.
  • histappend: If enabled, new history commands are appended to the history file instead of overwriting it.
  • histverify: When set, the shell will display the command from the history before executing it, allowing you to edit it if needed.
  • login_shell: Indicates whether the shell is a login shell or not.
  • extglob: Enables the use of extended pattern matching features.
  • globasciiranges: If set, the shell treats characters inside brackets [ ] as ASCII ranges rather than collating elements.

You can use the "shopt" command with specific options to enable or disable them. For example, to enable the "autocd" option, you would run "shopt -s autocd". To disable it, you would run "shopt -u autocd".

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the shopt tool