[SOLVED] Ubuntu 14.04 LTS enviroment variable woes

I'm not exactly sure what happened, but I sat down to use my laptop and it took forever for it to "wakeup" then the GUI login wouldn't work, and I had to do ctrl-alt-F2 to login. Here's an example error message when I tried to to "sudo reboot"

"Command sudo is available in usr'bin/sudo".

To check my environment variable I had to type,

"usr/bin/sudo /usr/bin/nano /etc/environment"

Nothing seems out of place in environment, what I have is

export JAVA_HOME="/usr/lib/jvm/java-7-oracle/jre/bin/java"
export PATH=$PATH:/usr/lib/jvm/java-7-oracle/jre/bin/java

This setup has been working for several weeks no problem. The last thing I remember doing configuration wise is that I installed IntelliJ IDEA, but I didn't do anything with environment, all I did was install it.

So right now I can't get to the regular desktop, and I have to type out the path to everything. Even "ls" doesn't work, or "cd.."

Any ideas? Thanks in advance for the help!

as a stop gap measure you can use alias to change /usr/bin/cd back to cd
just put the command into the /etc/bashrc file and reboot

Boot into a live CD, back up your stuff, and completely flatline everything and reinstall.

It will save you a really lot of time.

How did you install IntelliJ?

what does running 'echo $PATH' give you?

echo $PATH gives me this line,


To install IntelliJ I did tar -zxvf filename.tar.gz in usr/opt

Untaring into /usr is dangerous, but lets fix the problem we can see first ;)

Modify /etc/enviroment to this (remove the export bits):

PATH=$PATH:/usr/lib/jvm/java-7-oracle/jre/bin/java (or just remove this line)

please add 4 spaces or enclose use the </> button so we know the forum isn't mangling your pastes

Deleting the export bits and that last line seems to have fixed it. What was "export" doing?

I can't remember if I unpacked the tar in usr/opt, or in downloads then moved the contents.

export is a command so youd use it in a shell or script, but not in files that store data. Quite how it does what you saw i'd need to work out, but glad its fixed