Test Out Linux Pro 2.5.5 - Environment Variables (Practice Questions)
Which of the following commands configures the shell to retain 300 recently used commands in the ~/.bash_history file for multiple shell sessions?
HISTFILESIZE=300
Which environment variable affects the number of past commands stored in memory in the current shell session?
HISTSIZE
Which of the following statements BEST describes the PATH environment variable?
It contains the directory prefixes used to search for programs and files.
You want the directory /sbin/special to be include in the PATH environment variable. You also want to keep all the current directory entries currently in the PATH variable. Which of the following commands would you use?
PATH=$PATH:/sbin/special
You want to view the number of commands your bash shell is set to save by examining the current HISTSIZE environment variable. You don't want to have to scroll through all the environment variables. Which of the following commands is the BEST way to determine the current value of the HISTSIZE variable?
echo $HISTSIZE
Which of the following commands shows the value of the LANG environmental variable currently set for the language the operating system uses?
echo $LANG
Two users should have identical settings, yet one is having problems with the display on his screen, and you suspect there is a difference in their environment variables. Which of the following commands displays all of the environment variables?
env
You need to set the COMP variable to the value 1745. Which of the following commands sets the variable so it is inherited by subsequent child shells?
export COMP=1745
Which command displays all the environment variables defined in the shell?
printenv
Anna, a system administrator, wants to set a global variable that can be used each time she logs in. Currently, she has to set the variable each time a terminal is opened. Which of the following files would need to be modified to make a global variable persistent? (Choose TWO.)
~./bash_profile /etc/profile
You recently used the HOST=FS4 command. Which of the following commands should you use to change the HOST variable to a global variable that will be inherited by subsequent child shells and processes?
export HOST
Tim, a technician, created a local variable named val and set it to 5000 at the bash prompt. Tim wants to use the variable in a script. But when the script is executed, the value of val is not set to 5000. Which of the following commands would allow Tim to set a global variable that would be available to the script?
export val=5000