How can the export command in Linux be used to modify environment variables?
In Linux, one can modify environment variables using the export command. This command is used to set a variable or function as an environment variable, allowing it to be used in the current session and its child processes.
To modify environment variables, you can use the export command in the following format:
export environment_variable_name=value
To set the JAVA_HOME variable to the path /usr/lib/jvm/java-11-openjdk-amd64, you can run the following command:
Set the JAVA_HOME environment variable to /usr/lib/jvm/java-11-openjdk-amd64.
To add the PATH environment variable to a new path, you can use the following command:
Add the new path to the existing PATH variable.
Here, $PATH represents the current PATH value, and /new/path represents the new path to be added.
Please note that the export command will only modify the environment variables for the current session. If you want to permanently change the environment variables, you need to add the export command to the appropriate configuration file, such as ~/.bashrc or ~/.bash_profile. After making the modifications, you will need to re-login or execute the source command in order for the changes to take effect.