That's a great question! In Linux, environment variables are used to store information about the system environment.
The ~ (tilde) you just used is actually a shortcut for the $HOME environment variable. To see a list of all your environment variables, you can type this command in your terminal:
env
Here are a few common ones you'll often encounter:
$USER: The name of the current logged-in user.- Try:
echo $USER(Output should belabex)
- Try:
$HOME: The path to your home directory (same as~).- Try:
echo $HOME(Output should be/home/labex)
- Try:
$PWD: Your current working directory.- Try:
echo $PWD(Output should be/home/labex/project)
- Try:
$SHELL: The path to the shell program you are using.- Try:
echo $SHELL(Usually/usr/bin/zshor/bin/bash)
- Try:
$PATH: A list of directories the system searches through when you run a command (likelsorpwd).
Note: When you want to see the value of an environment variable, you must put a $ sign before the name.
Feel free to try echo $USER in your terminal to see it for yourself! Are you ready to move on with the file operation steps?