0

I edited .bashrc file with PATH value, but when I open a new terminal after this, none of command is working.

When i am opening a new terminal its giving :

bash: export: `/usr/lib/java/jdk1.7.0_51': not a valid identifier
bash: export: `=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/shilpa/sqllib/bin:/home/shilpa/sqllib/adm:/home/shilpa/sqllib/misc:/home/shilpa/sqllib/db2tss/bin:/bin': not a valid identifier
bash: export: `/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/shilpa/sqllib/bin:/home/shilpa/sqllib/adm:/home/shilpa/sqllib/misc:/home/shilpa/sqllib/db2tss/bin:Downloads/hadoop-1.2.1/bin': not a valid identifier

shilpa@ubuntu:~$ ls
bash: ls: No such file or directory

Please help me with this.

1
  • 2
    Can you post the contents of your .bashrc?
    – chaos
    Feb 23, 2014 at 21:39

4 Answers 4

5

In your current shell, reset a basic working path: PATH=/bin:/usr/bin

Then edit your .bashrc. Make sure when you're assigning to your path, that you don't make one of these mistakes:

  • use a dollar sign on the left hand side: $PATH=/foo:... # don't do this
  • allow spaces around the equal sign: PATH =/foo:... # don't do this
1

Probably you messed up the .bashrc file in your home directory.

Check it for errors or make a backup copy of the file and replace it with the example copy in /etc/skel/.bashrc

2
  • -1 if I could. He may have added a bunch of stuff to his .bashrc, which would be lost then. I assume he just messed up the line setting $PATH. I am optimistic: He probably does not have to start with a new .bashrc. (Although to give a better answer than this one, we would need the contents of his .bashrc, of course).
    – Keba
    Feb 23, 2014 at 21:46
  • @Keba replacing isn't necessary , one could just rename the original .bashrc the user had to something else like .bashrc.bak. That way functions and aliases are not lost entirely, one could still copy them over , while in the process of fixing whatever may have caused the isue. Jan 3, 2016 at 9:39
0

You have add some wrong code inside the bashrc file. Just type following raw in a new terminal. if it gives errors do it twice.

PATH=/bin:/usr/bin
0

There is /usr/share/base-files/dot.bashrc which is the .bashrc that comes by default for every user, and users then can edit their own $HOME/.bashrc. In addition to Glenn's suggestion, you could rename .bashrc as .bashrc.bak, open Nautilus, copy over /usr/share/base-files/dot.bashrc , rename it to .bashrc. That way you have default settings back, and you can deal with undoing changes in your original .bashrc later.

Even moving files isn't quite necessary. bash has option --rcfile file which allows specifying which file to use for personal settings, so you could even do this in terminal /bin/bash --rcfile /usr/share/base-files/dot.bashrc . That will give you back bash with proper environment and access to all the tools the way you are used to them, and of course opportunity to fix the original file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .