0
0
Linux CLIscripting~5 mins

export command in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the export command do in Linux?
The export command sets environment variables so that they are available to child processes started from the current shell.
Click to reveal answer
beginner
How do you make a variable named MY_VAR available to other programs using export?
You write: export MY_VAR=value. This sets MY_VAR and exports it to child processes.
Click to reveal answer
beginner
What happens if you set a variable without export?
The variable exists only in the current shell and is not passed to child processes or other programs.
Click to reveal answer
beginner
How can you see all exported environment variables in your current shell?
Use the command export -p or printenv to list all exported environment variables.
Click to reveal answer
intermediate
Can you export a variable that was already set without reassigning it?
Yes, just run export VARIABLE_NAME to export an existing variable without changing its value.
Click to reveal answer
What does the export command do?
ADeletes a variable
BLists all files in a directory
CChanges the shell prompt
DMakes a variable available to child processes
Which command exports a variable named PATH with a new value?
Aenv PATH=/usr/bin
Bexport PATH=/usr/bin
CPATH=/usr/bin
Dset PATH=/usr/bin
If you set a variable without export, what happens?
AIt is only available in the current shell
BIt is deleted immediately
CIt is available to child processes
DIt becomes a system variable
How do you list all exported variables?
Aexport -p
Blsenv
Cshowenv
Denvlist
Can you export a variable without assigning a new value?
AOnly if the variable is empty
BNo, you must assign a value
CYes, just use <code>export VARIABLE_NAME</code>
DOnly in root user
Explain in your own words what the export command does and why it is useful.
Think about how programs get information from the shell.
You got /3 concepts.
    Describe the difference between setting a variable with and without export.
    Consider where the variable can be seen or used.
    You got /3 concepts.