Can you list other environment variables?

QuestionsQuestions4 SkillsProDec, 21 2025
0177

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:

  1. $USER: The name of the current logged-in user.
    • Try: echo $USER (Output should be labex)
  2. $HOME: The path to your home directory (same as ~).
    • Try: echo $HOME (Output should be /home/labex)
  3. $PWD: Your current working directory.
    • Try: echo $PWD (Output should be /home/labex/project)
  4. $SHELL: The path to the shell program you are using.
    • Try: echo $SHELL (Usually /usr/bin/zsh or /bin/bash)
  5. $PATH: A list of directories the system searches through when you run a command (like ls or pwd).

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?

0 Comments

no data
Be the first to share your comment!