Hi, this is Sandra Henry-Stocker, author of the “Unix as a Second Language” blog on NetworkWorld.
In this Linux tip, we’re going to look at the unset command. It’s a command that removes an environment variable from your current login session. If, for some reason, an environment variable is interfering with something you’re trying to do, unset it as shown here (4th line):
It’s as easy as that. Since most environment variables are set up whenever you log into the system, it will be back when you log in again unless you also remove it from your .bashrc or other start-up file. If the variable is set up in a system file that is run when you first log in, you can use the unset command in your .bashrc file to deactivate it.
If you unset a variable that you realize you hadn’t meant to unset, you can set it up again by simply defining it or by sourcing your .bashrc file where it is likely defined. If you run this command, for example, your prompt would be gone:
You could easily reset it with one of these commands:
That’s your Linux tip for the unset command.
If you have questions or would like to suggest a topic, please add a comment below. And don’t forget to subscribe to the IDG Tech(talk) channel on YouTube.
If you liked this video, please hit the like and share buttons. For more Linux tips, be sure to follow us on Facebook, YouTube and NetworkWorld.com.