Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i'm relearning some linux stuff, i recall that after i make edits to this file, i should issue a command that reloads the file and checks it for errors for safety reasons. Anyone know what the command is? I think the command is "source". However, when I su to root, and type in "source", it says it cannot find it. How do I make the Path include/find it?

share|improve this question
up vote 3 down vote accepted

I think that source is a bash builtin, so if you aren't finding it when you are logged in as root, then you might not be running bash. You can try starting a bash shell just by typing bash. Or try the syntax . /etc/profile instead. Example (notice the space between the dot and /etc/profile):

jed@jed-osx:~$ . /etc/profile

Since source didn't work for you, I'm guessing you aren't running bash when logged in as root. You can determine this with echo $SHELL. Here is an example from my OSX system:

jed@jed-osx:~$ echo $SHELL

Here is an example from a FreeBSD system:

FreeBSDBox[1001] # echo $SHELL
share|improve this answer
the dot (.) did it, is it possible to explain a little how/why it works this way, the dot thing ahead of /etc/profile (./etc/profile)? – user8160 Jun 18 '10 at 22:39
Did you do it with a space between the dot and the /etc/profile? That is what I was suggesting, and I actually learned that it is a shortcut for the source bash builtin with a question on stackoverflow (…). If you did it without the space, then you were basically just executing /etc/profile as a script, which will work just the same, if it is executable. – Jed Daniels Jun 18 '10 at 22:57
i issued "source ./etc/profile" and it worked, the command was found and the file reloaded. You are saying I could have ". /etc/profile"? – user8160 Jun 18 '10 at 22:59
"which will work just the same, if it is executable" - No, because the changes made to its environment won't persist in the current environment. That's the purpose of using source or .. If a script sets variables or does cd, for example, then exits, the interactive shell (or parent script) doesn't see those changes. If it's sourced, it's as if the commands it contains were typed at the command line (or included directly in the parent script). – Dennis Williamson Jun 19 '10 at 0:24
No, export affects what is visible by child processes. The parent doesn't see the changes even if the variable is marked for export. See my answer here for a discussion and demonstration. – Dennis Williamson Jun 19 '10 at 2:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.