生效 ./etc/profile
时间: 2023-08-21 20:04:10 浏览: 95
要使更改在`/etc/profile`文件中生效,您需要以管理员权限执行以下命令:
```
source /etc/profile
```
这将重新加载`/etc/profile`文件中的环境变量,以便新的更改生效。
请注意,执行此命令需要管理员权限,因此您可能需要在命令前加上`sudo`,并输入管理员密码。
```
sudo source /etc/profile
```
请确保在执行此命令之前,您已经正确地编辑了`/etc/profile`文件,并将所需的更改添加到其中。
相关问题
[root@openEuler ~]# vi /etc/profile HISTSIZE=1000 if [ "$HISTCONTROL" = "ignorespace" ] ; then export HISTCONTROL=ignoreboth else export HISTCONTROL=ignoredups fi export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do if [ -r "$i" ]; then if [ "${-#*i}" != "$-" ]; then . "$i" else . "$i" >/dev/null fi fi done unset i unset -f pathmunge if [ -n "${BASH_VERSION-}" ] ; then if [ -f /etc/bashrc ] ; then # Bash login shells run only /etc/profile # Bash non-login shells run only /etc/bashrc # Check for double sourcing is done in /etc/bashrc. . /etc/bashrc fi fi export LANG=en_US.UTF-8 export GPHOME=/opt/opengauss3.0/install/om export PATH=$GPHOME/script/gspylib/pssh/bin:$GPHOME/script:$PATH export LD_LIBRARY_PATH=$GPHOME/script/gspylib/clib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=$GPHOME/lib:$LD_LIBRARY_PATH export PYTHONPATH=$GPHOME/lib export PATH=/root/gauss_om/omm/script:$PATH 如何操作能够把把最后两个LD_LIBRARY_PATH参数注释掉重启
你可以通过编辑文件`/etc/profile`来注释掉最后两个`LD_LIBRARY_PATH`参数并重启系统。请按照以下步骤进行操作:
1. 使用命令行编辑器(如vi、nano等)打开文件`/etc/profile`。
```shell
vi /etc/profile
```
2. 在文件中找到以下两行:
```shell
export LD_LIBRARY_PATH=$GPHOME/script/gspylib/clib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$GPHOME/lib:$LD_LIBRARY_PATH
```
3. 将这两行前面添加注释符号`#`,即注释掉这两行:
```shell
# export LD_LIBRARY_PATH=$GPHOME/script/gspylib/clib:$LD_LIBRARY_PATH
# export LD_LIBRARY_PATH=$GPHOME/lib:$LD_LIBRARY_PATH
```
4. 保存文件并退出编辑器。
5. 重启系统,以使更改生效。你可以使用以下命令重启:
```shell
sudo reboot
```
这样,最后两个`LD_LIBRARY_PATH`参数将被注释掉,并在系统重启后生效。
如何生效/etc/profile文件
/etc/profile 是Linux系统中的一个默认环境配置文件,它主要用于初始化用户的环境变量和设置,比如路径(PATH)、shell等。要让这个文件生效,你可以按照以下步骤操作:
1. **登录shell**: 首先,你需要通过SSH或者其他方式登录到你的Linux服务器。
2. **修改文件**: 使用文本编辑器(如`vim`, `nano`, 或者`gedit`),打开 `/etc/profile` 文件:
```
sudo nano /etc/profile
```
如果你是非root用户,通常需要输入密码。
3. **添加或修改内容**: 在文件中添加、编辑或者删除环境变量设置。例如,如果你想增加一个新的路径,可以加入类似这样的行:
```bash
export PATH=$PATH:/path/to/new/directory
```
4. **保存并退出**: 修改完成后,按`Ctrl+X`,然后按`Y`确认保存,最后按`Enter`。
5. **使更改生效**: 对于一次性改变,可以运行以下命令使得修改立即生效:
```
source ~/.profile
```
如果你想让所有新开的终端窗口都应用新的环境变量,可以运行:
```
exec $SHELL
```
或者重启终端。
6. **永久生效**: 如果希望对所有用户都生效,你需要将改动写入到`/etc/profile.d/*.sh`目录下的脚本文件中,然后执行`source /etc/profile`。
记住,每次修改了环境变量后,最好重启或者重新加载shell,让新的配置生效。
阅读全文
相关推荐















