After changing /etc/profile, what do I have to do to reset my shell?

LinuxUnix

Linux Problem Overview


To test its effects immediately instead of having to reload the terminal

Linux Solutions


Solution 1 - Linux

use source /etc/profile

for details, man source or you can checkout this link http://bash.cyberciti.biz/guide/Source_command

Solution 2 - Linux

If this is bash you can do . /etc/profile, it's the same as doing source /etc/profile.

Solution 3 - Linux

As sjr says, you can approximate the effect of the change by re-reading /etc/profile using the dot . (or, in Bash, source) command.

However, you need to be aware that /etc/profile gets to work with a more minimal starting environment, so the effect you get by rereading the profile is not necessarily identical to the effect you get on login. You can simulate the original environment more accurately using the env command to unset the environment. With bash, you can use the -l option to make the shell behave more like a login shell - in conjunction with env, you can simulate the login environment accurately:

env -i HOME=$HOME PATH=/bin:/usr/bin USER=$USER ... bash -l

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTIMEXView Question on Stackoverflow
Solution 1 - LinuxSerdar DalgicView Answer on Stackoverflow
Solution 2 - LinuxsjrView Answer on Stackoverflow
Solution 3 - LinuxJonathan LefflerView Answer on Stackoverflow