First, Linux:
1. View instructions for all environment variables
Method 1:$:export (Export command is to display, set, or delete Linux environment variables ;)
Method 2:$:env
2. View a specified environment variable
Method 1:$:export PATH
Method 2:$:echo $PATH
3. Modify the settings for an environment variable:
1) temporarily modify an environment variable, the next time after power-on invalid
Method A:$:echo "xxx to append content xxxx" >> $PATH
Method B:$:export path= "xxx to modify the content of XXXX"
Method c:$: Export path= $PATH:/usr/xxxx The path to append ( where colon is a delimiter between directories )
Method d:$: path= "xxx to modify the content of XXXX"
2) Add path to/etc/profile, this method permanently modifies an environment variable for all users
$: Export path= $PATH:/usr/xxxx The path to append (where colons are delimiters between directories)
$: Sourcr/etc/profile
3) Add path to the current ~/.bash_profile, which is permanently active for the current user. Similar to the second step, replace the profile with Bash_profile.
$: Export path= $PATH:/usr/xxxx The path to append (where colons are delimiters between directories)
$: Source ~/.bash_profile
Second, window: (The use of set is similar to the use of export in Linux, but in Windows it is not the $ variable name, but the% variable name%)
1. View instructions for all environment variables
$:set (the SET command is to display, set, or delete Windows environment variables ;)
2. View a specified environment variable
Method a:$:P Ath (directly enter an environment variable name, Eg:path)
Method B:$:echo%Path%
Method C:$:set%Path%
3. Modify the settings for an environment variable:
Third, Linux will add instructions to start the boot
Add the instructions in the/etc/rc.local
| 1 |
/usr/local/webserver/mongodb/bin/mongod --dbpath=/data0/mongodb/data --logpath=/data0/mongodb/logs --logappend --port=27017 |
Similarities and differences between 3,/etc/rc.local and/etc/rc.d/
The/etc/rc.local script is executed after the system initialization level script runs, so you can safely add scripts that you want to execute after the system starts. The/etc/rc.local is connected to the/etc/rc.d/rc.local soft connection and is actually a thing.
The/etc/rc.d/directory contains many system startup and stop scripts for various services, which control all kinds of transactions from Acpid to X11-common, similar to the registry for Windows. The contents of the/etc/rc.d/directory are as follows:
(1) init.d/: Binary files directory for various servers and programs.
(2) rcx.d/: The Executing program connection directory at each boot level. Everything inside is a soft connection pointing to the init.d/. Specific behind the narration.
(3) There are three more scripts: Rc.sysinit, RC, rc.local.
Linux/windows View SET environment variable directives