Linux Commands Reference - Complete Linux Command Guide

Comprehensive Linux command reference with 150+ commands. Search, filter by category, and view detailed usage examples.

Share
Back to commands

unset

Remove shell variables or functions

Syntax

unset [-fv] [NAME]...

Common Options

-vUnset variable (default)
-fUnset function
-nUnset nameref

Common Examples

unset MYVAR

Unset variable

unset -f myfunc

Unset function

unset VAR1 VAR2 VAR3

Unset multiple variables

unset PATH

Unset PATH (dangerous!)

for v in $(compgen -v); do unset $v; done

Clear all variables

unset -n ref

Unset nameref

Related Commands

Related Tools

More Code & Dev Tools