LinuxCommandLibrary

disable

Disable shell builtins or other named elements

TLDR

Disable a shell builtin

$ disable [builtin_name]
copy
Disable a shell function
$ disable -f [function_name]
copy
Disable a reserved word
$ disable -r [reserved_word]
copy
List all disabled builtins
$ disable
copy
Re-enable a disabled builtin
$ enable [builtin_name]
copy

SYNOPSIS

disable [-afmprs] [name ...]

DESCRIPTION

disable is a zsh builtin that prevents named elements from being used. When a builtin is disabled, the shell will search $PATH for an external command of the same name instead. This is useful for forcing the use of an external version of a command over the shell builtin, such as using an external echo or test instead of the builtin version.
Disabled elements can be re-enabled with the enable builtin.

PARAMETERS

-a

Disable aliases
-f
Disable shell functions
-m
Treat arguments as patterns for matching
-p
Disable shell parameters (variables)
-r
Disable reserved words
-s
Disable suffix aliases (zsh)

CAVEATS

Only available in zsh. In bash, the equivalent functionality is provided by enable -n. Disabling critical builtins like cd or exit can make the shell difficult to use. The effect does not persist across shell sessions unless added to shell configuration files.

HISTORY

The concept of disabling builtins was introduced in bash with the enable -n syntax. Zsh provides the dedicated disable command as part of its more modular approach to shell configuration, extending the concept to functions, aliases, and reserved words.

SEE ALSO

enable(1), builtin(1), zsh(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community