Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

Problem description : I am using something called play framework in my development which requires me to make the python script play available in the path. Hence I create a symbolic link in /usr/local/bin ... Now I have written a shell script (call it which calls this python script as follows : play status <some values here related to my app> &> /tmp/xyz.txt and this shell script then sends me the file via email. This works perfectly when I execute the script as follows ./ However when the script is executed as a cron expression everyday I get an output from stderr saying 'play: command not found'.

Hence I did some digging on my own and here are my findings :

  1. echo $PATH when I am on the shell shows that I have /usr/local/bin available to me hence I can successfully execute the command play status
  2. however when I type in sudo bash and then echo $PATH I do not have the path /usr/local/bin anymore. It is a limited set of folders (one of them being /usr/bin).

Q : Why this behavior ?! I fail to understand why the path is different. Also as a workaround would you suggest I do :

  • new symbolic link from /usr/bin to /usr/local/bin (what are the side effects of this?)
  • remove /usr/local/bin sym link altogether and only use /usr/bin
  • is there a convention that I am not following here for linking new programs and executing them from $PATH ?


share|improve this question
up vote 2 down vote accepted

All users, including root, have a set of environment variables that are applied each time a new shell is opened.

For a normal user you can add to the existing path by editing ~/.bashrc and putting the followling line at the very end:


For root I believe you would have to edit /root/.bashrc instead. In this case however it probably makes sense to make sure that all users have this in their path and for this you can use the edit line above and just put it at the end of the file /etc/bash.bashrc

share|improve this answer
But if i am logged in as root user, what difference does it make if I execute sudo bash ? Am I already not the root user? What additional privileges does this provide?! – cyberjar09 Nov 24 '12 at 6:41
and if the root user has the path /usr/local/bin in the ENV variable, why does the cron job running execute with the privileges similar to that of sudo bash ? – cyberjar09 Nov 24 '12 at 6:44
No, you're not the root user, you're an admin user which is a normal user with admin privileges. As soon as you type "sudo bash" it invokes another shell as root. – fabricator4 Nov 24 '12 at 7:24

I would recommend you simply move the symbolic link to /usr/bin.

share|improve this answer
whats would be the effect of linking /usr/bin/play to point to /usr/local/bin/play ? – cyberjar09 Nov 24 '12 at 6:32
Also, what would be the effect of having /usr/bin/play and /usr/local/bin/play sym link to /root/play-folder/play-script ? – cyberjar09 Nov 24 '12 at 6:39
I was thinking that you should just have the symbolic link to play in /usr/bin/play since having it in both places would be pointless if everyone has /usr/bin in their path. – ShadowNinja Nov 24 '12 at 16:53

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.