3

Every time I close my terminal and reopen it, simples command(e.g. ls) doesn't work. It shows the following error,

irfan@irfan-Y500-Elementery:~$ ls
Command 'ls' is available in '/bin/ls'
The command could not be located because '/bin' is not included in the PATH environment variable.
ls: command not found

I have to execute the following command export PATH=/usr/bin:/bin every time to correct this error,

irfan@irfan-Y500-Elementery:~$ export PATH=/usr/bin:/bin
irfan@irfan-Y500-Elementery:~$ ls
Assets   Documents        Example.java     Music       Public     Videos
Blender  Downloads        export           output.pdf  sudo
Desktop  Elementary Luna  jmonkeyplatform  Pictures    Templates

My questions is, why I have to do it every time? and what do I have to do to solve the repetition.

My /etc/environment files contains the following,

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
CLUTTER_PAINT=disable-clipped-redraws:disable-culling

Note : I am using ElementaryOS(based on Ubuntu 12.04)

Edit 1:

echo $PATH returns /usr/local/jre1.7.0_51/bin:

I followed this answer to set java path.

I added

PATH=/usr/local/jre1.7.0_51/bin:
export PATH 

to my /home/irfan/.bashrc file. I guess this caused the problem

1 Answers1

3

With your problem with the .bashrc file, your method of specifying this only:

PATH=/usr/local/jre1.7.0_51/bin:
export PATH 

likely overwrote the original $PATH - including those already specified. so, to add /usr/local/jre1.7.0_51/bin as a path, in a similar manner to my suggestion above:

echo 'PATH DEFAULT=${PATH}:/usr/local/jre1.7.0_51/bin' >> ~/.pam_environment

This should add it as a path without overwriting the others in $PATH. It should work if you reboot/logout & login/something like that - you will see it in echo $PATH if it works.

Wilf
  • 30,732