Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

Iam newbi to SUSE, I installed java in my SUSE linux Server edition, So i want to set the path in linux,So i created .bash_profile in in /root path using touch and added the path as "JAVA_PATH". When restart my linux the above command is not working and it show unknown command "JAVA_PATH", I can't able to boot in GUI mode, I can boot only in terminal mode, How to delete the file (.bash_profile in /root) ? And how to add java path in SUSE

Note: Before all the commands are working fine

Thanks in Advance, Jak...

share|improve this question

migrated from Jan 3 '11 at 16:12

This question came from our site for professional and enthusiast programmers.

It's not a good idea to run as root, anyway. – Keith Jan 4 '11 at 7:53

You probably damaged your .bash_profile and now you don't have a functional PATH variable.

To delete your .bash_profile, you will have to call the fully qualified name of the executable /bin/rm (instead of just rm). The problem is that this will likely make your problem worse, not better.

To edit the existing .bash_profile and set it to a good state, use /usr/bin/vi and set it to

If you cannot revert you .bash_profile back to it's original form, you should attempt to set it to

# .bash_profile

# Get the aliases and functions 
if [ -f ~/.bashrc ]; then
  . ~/.bashrc

# User specific environment and startup programs


export BASH_ENV
export PATH

It is a very bad idea to do normal work as root, as you have the ability to irreversibly destroy your system (by creating more work to "set it back again" than it's worth).

share|improve this answer

You have probably overwritten your PATH entirely. Try:


And then remove the .bash_profile:

rm .bash_profile

You can also specify programs with their full path:

/bin/rm /root/.bash_profile
share|improve this answer

Ah... I remember those newbie days. It is very easy to get burned when playing with fire.

    root# bash
    root# export PATH=/usr/bin:/bin:/sbin
    root# cd /root
    root# mv .bash_profile .bash_profile.backup-to-inspect
    root# shutdown -r now

Anyway, these commands will move ".bash_profile" away, but keeps a backup so that you can take a look at it and find out what naughty sort of thing you did to it. It will also reboot the computer.

Some important lessons that you should learn so as to avoid being burned in the future:

  1. Don't mess with root / system settings unless you really know what you're doing (edit your own ~/.bashrc file for your normal user account, before screwing with the root one, and try the command on the commandline and make sure it does what you expect before putting it in your ~/.bashrc).
  2. Always make backups. If there was a /root/.bash_profile, it is generally a good idea to copy it to /root/.bash_profile.orig (if it is the original copy) or /root/.bash_profile.backup before editing it.

When your computer reboots, you should take a look at what you put in that file:

cat /root/.bash_profile | less

I suspect that you did something like:


Instead of:


Or something else that modified your PATH environment variable.

share|improve this answer

You must log in to answer this question.