An ad-free and cookie-free website.
Learn to remove variables and functions at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux unset Command Summary with Examples (3:22)
Our forty-ninth word, or command to memorize is
unset from our category
unset allows you to remove variables
||Unset a variable|
||Unset a function|
set, we've been working with
unset will provide
for us an easy way to remove them.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s).
unset command has
2 options and the argument is the variable name.
Unlike most commands, help is not available with double-dash
--help because it's a shell built-in,
set, so on most systems
documentation hides in the manual page for
-v option, the default, removes
-f is for functions.
So why is
unset an important command?
unset offers a simple way to
remove shell and environment variables, plus functions as well.
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go. Let's keep it simple and resurrect what we did for
export, except this time do it in one
step. Recall, we made a variable called BBTEAM, for
baseball team, and set the value to my favorite, the San Francisco
Giants, and here's how we'll do it in one step.
And then now, test it with
printenv BBTEAM. All set.
Then we'll remove it using
And last, test it with another
Okay now you know how to use
And you know the syntax for commands, options and arguments.
One last tip about the
So this ends a mini-set of videos on variables, next we'll shift
gears and talk about resources. That sounds fun, doesn't it?
Okay, thanks for visiting today. I hope this was a helpful
introduction to the
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
We have fun with Linux on our YouTube Channel, please join us by subscribing there and following @factorpad on Twitter for introductions to new content.
setcommand, hit Back.
statcommand, click Next.
A newly-updated free resource. Connect and refer a friend today.