shopt
shell builtinLinux/Unix
The shopt command is one of the most frequently used commands in Linux/Unix-like operating systems. shopt Set and unset shell options
Quick Reference
Command Name:
shopt
Category:
shell builtin
Platform:
Linux/Unix
Basic Usage:
shopt [options] [arguments]
Common Use Cases
Syntax
shopt [-pqsu] [-o] [optname...]
Options
Option | Description |
---|---|
-s |
Set (enable) each specified option |
-u |
Unset (disable) each specified option |
-q |
Quiet mode; suppress output and return status indicates if option is set |
-p |
Display a list of all settable options with an indication of whether each is set |
-o |
Restrict the values of optname to those defined for the -o option to the set builtin |
Common Options | Description |
---|---|
cdspell |
Auto-correct minor errors in directory names for the cd command |
checkwinsize |
Update the values of LINES and COLUMNS after each command if necessary |
cmdhist |
Save multi-line commands in history as a single entry |
dotglob |
Include hidden files (starting with .) in pathname expansion |
extglob |
Enable extended pattern matching features |
failglob |
Cause patterns that match no files to produce an error |
globstar |
The ** pattern will match all files and zero or more directories and subdirectories |
histappend |
Append to history file rather than overwriting it |
nocaseglob |
Case-insensitive pathname expansion |
nullglob |
Patterns which match no files expand to a null string, rather than themselves |
Examples
How to Use These Examples
The examples below show common ways to use the shopt
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
shopt