unset
Quick Reference
Command Name:
unset
Category:
shell builtin
Platform:
Linux/Unix
Basic Usage:
Common Use Cases
Syntax
unset [-fv] [name ...]
Options
Option | Description |
---|---|
-f |
Treat each NAME as a shell function |
-v |
Treat each NAME as a shell variable |
-n |
Treat each NAME as a name reference (nameref) variable (bash 4.3+) |
If neither -f
nor -v
is supplied, unset
first tries to unset a variable, and if that fails, tries to unset a function.
Examples
How to Use These Examples
The examples below show common ways to use the unset
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.