I've modified the .profile file of a user. It contains some new environement vars, how can i reload this file without restarting the server ?

The .profile file is only charged when the system boots or in any other case ??

Thanks in advance.

有帮助吗?

解决方案

Normally the file gets parsed on startup of a new shell (not at system boot!). So you can just start another shell and your changes to ~/.profile will be present. However, you can also "source" the file in the current shell session:

source ~/.profile

Note that source is just human readable shortcut for the . command. So, you can also issue

. ~/.profile

Thanks to @chepner for explaining that source is an alias of . and not vise versa.

其他提示

You can do it like this:

$ . ~/.profile 

This is doing the same as:

$ source ~/.profile 

The file will be executed (interpreted) by the current shell, all changes to environment variables will affect your current session.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top