3

Last time when I added JAVA_HOME="/usr/lib/jvm/open-jdk" (java path could be different) source /etc/environment (and this too ) at the end of bashrc file. when i saved and exited, Terminal keeps asking for password all the time , though I am putting correct password .. Is there a way to open bashrc file and remove source /.../ ??

1
  • 2
    @Serg you are right. I did that. Can you please convert your comment as Answer. – Asad Feb 16 '16 at 15:54
3

Since you're using GUI, you can open the file with gedit text editor and correct whatever issues you may have with $HOME/.bashrc.

Alternatively, one could spawn dash , Debian Amquist Shell, which is default scripting shell for Ubuntu. Press Alt+F2 and run gnome-terminal -e dash. This will launch gnome-terminal with dash, and then you can access and edit your file with nano $HOME/.bashrc

2

I can't use command line what do I do? use GUI i.e. Nautilus (file manager)

Now go to /etc directory in root, and look for skel directory, now press Ctrl + H to see hidden files, now right click to copy .bashrc file in it.

Now go to your home directory, rename your old messed up .bashrc file, right click rename it to .bashrc_backup or anything your like. Now right click paste the new .bashrc file. Done!

Additionally: you can open old .bashrc file ( now .bashrc_backup) and copy your old aliases or modified $PATH if any and paste then at the end of new .bashrc file. In this case you can use Gedit (text editor) to edit them (In this case I believe $PATH and aliases are fine, if not ignore them)

0

You can restore your bashrc

Backup:

 cp ~/.bashrc ~/.bashrc.bak

Copy .bashrc file over yours:

  cp /etc/skel/.bashrc ~/

Load the new one:

 source ~/.bashrc
3
  • Yes . . . but if .bashrc is messed up, how does one get to the terminal to execute all these commands in the first place ? – Sergiy Kolodyazhnyy Feb 16 '16 at 16:23
  • 3
    you can use nautilus (file manager) to copy and rename files – Edward Torvalds Feb 16 '16 at 16:27
  • 1
    @edwardtorvalds That's the better approach. The cp command is basically inaccessible for user, but file manager tools are accessible. That's exactly what GAD3R should have posted – Sergiy Kolodyazhnyy Feb 16 '16 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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