DotLinux.net
Toggle Menu
Home
Topics
Linux Basics
Command Line
Shell Scripting
Networking
Security
Administration
Blogs
Latest Blogs
Quizzes
Disk and Storage Management
File System and Permissions
Linux Command Line Basics
Linux Environment and Variables
Networking Fundamentals
Package Management
Process and System Monitoring
Shell Scripting Basics
System Boot and Services
User and Group Management
Tools
Online Bash Compiler
About
Linux Environment and Variables
Test knowledge of environment variables and shell configuration.
1. What command is used to display the value of an environment variable?
echo
print
show
get
2. Which environment variable holds the current user's home directory?
HOME
USER_HOME
HOME_DIR
USER_DIR
3. What does the PATH environment variable specify?
List of directories to search for executable files
Current working directory
User's home directory
System configuration directory
4. Which command lists all environment variables?
env
listenv
variables
showenv
5. How do you reference an environment variable in a shell command?
$VAR
%VAR%
VAR$
{VAR}
6. Which file is typically used to set environment variables for all users on the system?
/etc/environment
~/.bashrc
~/.profile
/etc/bashrc
7. What is the default shell for most Linux systems?
bash
zsh
sh
csh
8. Which environment variable stores the current working directory?
PWD
CWD
DIR
CURRENT_DIR
9. How do you make an environment variable available to child processes?
export VAR=value
set VAR=value
env VAR=value
put VAR=value
10. Which command is used to unset an environment variable?
unset
remove
delete
clear
11. Which of the following are common environment variables in Linux?
PATH
HOME
USER
CPU
MEM
12. Which files are used to set user-specific environment variables that persist across sessions?
~/.bashrc
~/.bash_profile
/etc/profile
/etc/environment
~/.bash_logout
13. Which commands can be used to display environment variables?
env
printenv
echo
set
export
14. Which of the following statements about environment variables are true?
They are key-value pairs
They are global to the system
They can be modified by the user
They are stored in the BIOS
They affect the behavior of processes
15. Environment variables set in a shell session are available to parent processes.
True
False
16. The USER environment variable contains the username of the current user.
True
False
17. The 'export' command is required to make a variable an environment variable (as opposed to a shell variable).
True
False
18. What command is used to display the value of the PATH environment variable?
19. What file in a user's home directory is commonly used to set environment variables that take effect when a new interactive shell starts?
20. What environment variable is used to specify the default editor for command-line tools?
Reset
Answered 0 of 0 — 0 correct