An environment variable is a worth available in your laptop globally, which might most likely contain the remaining from the path to the root checklist, the home checklist, and a secret token.
This command can divulge the checklist of the ones atmosphere variables. It’s going to even be used so to upload, exchange and remove a variable.
Customary syntax for env
command:
$ env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]
1. Run a process without the existing atmosphere variables
env -i your_command
The -i
or --ignore-environment
selection runs the command with an empty atmosphere
Example: Type env -i /bin/sh
to create a brand spanking new atmosphere without any present surroundings variables.
2. Add an environment variable
env variable_name
Use the env variable_name
command to set a brand spanking new atmosphere variable.
Example: Set a brand spanking new surroundings variable named Example.
3. Remove an environment variable
env -u variable_name
Use the -u
or --unset
selection to remove the variable from the environment.
Example: Eliminating the Example surroundings variable. As you’ll see throughout the screenshot, the variable we no longer too way back created no longer exists.
4. Remove the street harm from the environment variables checklist
env -0
The -0
or --null
selection ends each and every line of output with a 0 (null) byte, not a newline.
Example: The use of the env
command to separate output lines with the NULL character.
Further Linux directions:
Checklist Operations | rmdir · cd · pwd · exa · ls |
Report Operations | cat · cp · dd · much less · contact · ln · rename · extra · head |
Report Device Operations | chown · mkfs · find |
Networking | ping · curl · wget · iptables · mtr |
Search and Text Processing | to find · grep · sed · whatis · ripgrep · fd · tldr |
Device Wisdom and Keep an eye on | env · historical past · best · who · htop · glances · lsof |
Particular person and Session Keep an eye on | display · su · sudo · open |
The submit How you can Use the Env Command in Linux seemed first on Hongkiat.
Supply: https://www.hongkiat.com/blog/linux-command-env/
0 Comments