Environment variables
The shell makes several environment variables available to commands. You can use an environment variable anywhere in a command by typing $ (dollar sign) followed by the environment variable name. For example, this command
$ echo This is $HOSTNAME running on an $HOSTTYPE
displays a line such as
This is LSERVER running on an i386
Table below lists some of the more useful environment variables that are available to you and your commands.
Environment Variables
Variable | Description |
HOME | The current user's home directory. |
HOSTNAME | The computer's host name. |
HOSTTYPE | The host computer type. |
OSTYPE | The operating system. |
PATH | The search order for executable programs. |
PROMPT_COMMAND | The command used to generate the prompt. |
PWD | The present working directory. |
SHELL | The shell being used. |
USERNAME | The current username. |
In this tutorial:
- Linux Commands
- Command Shell Basics
- Editing commands
- Wildcards
- Redirection and piping
- Environment variables
- Shell scripts
- Directory and File Handling Commands
- The cd command
- The mkdir command
- The rmdir command
- The ls command
- The cp command
- The rm command
- The mv command
- The touch command
- The cat command
- Commands for Working with Packages and Services
- The rpm command
- Commands for Administering Users
- The usermod command
- The chage command
- The passwd command
- The newusers command
- The groupadd command
- The groupdel command
- Commands for Managing Ownership and Permissions
- The chgrp command
- The chmod command
- Networking Commands
- The ipconfig command
- The netstat command
- The ping command
- The route command
- The traceroute command