Variables are divided into system variables and user-defined variables, and their profiles are of course divided into system environment variable configuration file and user environment variable control file.
1. Specify the configuration file for the environment variable
[Email protected] 111]# Vim/etc/profile
We recommend that you create a *.sh file under/ETC/PROFILE.D to modify
2. Variables in the configuration file that modify the global parameters
[Email protected] 111]# vim/etc/profile.d/path.sh
#!/bin/bash
Export path= $PATH:/tmp/:/date/bin/
~
~
: Wq
[[email protected] 111]# source/etc/profile//Reset Effective
[[email protected] 111]# echo $PATH view
3. Modify the system's bash system configuration file
The location of the directory is
[Email protected] 111]# VIM/ETC/BASHRC
Modify the PS1 variable inside the BASHRC
[Email protected] 111]# echo $PS 1
[\[email protected]\h \w]\$
[[email protected] 111]# ps1= ' [\[email protected]\h\t \w]\$ '
[[Email protected]:51:02/111]#
Change back is to change ' t ' W ' to ' W '
[Email protected]:51:02/111]# ps1= ' [\[email protected]\h \w]\$ '
[Email protected] 111]# echo $PS 1
[\[email protected]\h \w]\$
Change the Umask value
[Email protected] 111]# vim/etc/profile.d/umask.sh
umask 0012
~
~
: Wq
[Email protected] 111]# Source/etc/profile
[Email protected] 111]# umask
0012
And then change back to 0022 as above, reset takes effect. View Umask
//////////////////////////////////////////////////////////////////////////////////////////
The user modifies the environment variable profile to switch to that user and then modifies
Switch users first
[[Email protected] 111]# CD
[Email protected] ~]# ls-a.
. bash_profile
User-defined environment variables
. BASHRC
User-defined aliases
///////////////////////////////////////////////////////////////////////////////////////////////
Summary: vim/etc/profile.d/**.sh variables that modify global parameters Source/etc/profile variable restart takes effect
User variable switch to user under Modify
Getting started with the shell-system and user profiles