Shell

set

Set or unset shell options and positional parameters.

Synopsis

syntax
set [OPTION]... [ARG]...

Examples

Strict mode for bash scripts
set -euo pipefail
Enable command tracing
set -x
Disable command tracing
set +x
Set positional parameters
set -- arg1 arg2

Common options

FlagDescription
-eExit immediately on error
-uTreat unset variables as error
-xPrint commands before execution
-o pipefailPipe fails if any command fails
+xDisable tracing (+ disables options)

About set

The `set` command set or unset shell options and positional parameters. Shell commands configure your interactive environment — variables, aliases, history, and shell options.

The shell is your primary interface with Linux, and customizing it improves productivity. These commands work across bash, zsh, and other POSIX-compatible shells with minor differences.

The command accepts 5 commonly used flags shown above, though the full set of options is available in the man page (`man set`). The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.

Related commands

More Shell Commands

Other commands in the Shell category

Related tools