Solved

/root/.bashrc error

Posted on 2006-06-22
8
1,089 Views
Last Modified: 2011-08-18
Hi, I thought I made a very serious mistake.

I modified /root/.bashrc using vi and adding some path in it like:
export JAVA_HOME=/opt/jdk1.5.0_07
export PATH=/opt/jdk1.5.0_07/bin
Now, I am not able to use vi, chmod, cp, mv, cd /root...etc

Does there have anyway I can recover the file?

I use fedora core5.
0
Comment
Question by:ddlam
  • 2
  • 2
  • 2
  • +2
8 Comments
 
LVL 15

Expert Comment

by:DonConsolio
ID: 16962562
try:

/bin/mv .bashrc .bashrc.old
0
 
LVL 5

Assisted Solution

by:csgeekpyro
csgeekpyro earned 50 total points
ID: 16962577
change the PATH line to read and everything should be fine:

export PATH=$PATH:/opt/jdk1.5.0_07/bin

Then just run:

source ~/.bashrc

0
 
LVL 15

Assisted Solution

by:DonConsolio
DonConsolio earned 50 total points
ID: 16962593
the correct setting would be:

>export JAVA_HOME=/opt/jdk1.5.0_07
ok
>export PATH=/opt/jdk1.5.0_07/bin
PATH="$PATH:/opt/jdk1.5.0_07/bin"
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
LVL 11

Accepted Solution

by:
kblack05 earned 350 total points
ID: 16962741
You need to add the server environment to the path. In your path statement of the .bashrc make sure you include not only the paths you need but the server path also:

PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin:/usr/lib/java/bin:/usr/lib/java/jre/bin:/opt/kde/bin:/usr/lib/qt/bin:/usr/share/texmf/bin:/opt/jdk1.5.0_07/bin

Regards,

~K Black
0
 
LVL 5

Expert Comment

by:csgeekpyro
ID: 16963184
In an FC5 system, those paths are already in the $PATH var when .bashrc is sourced.  Most likely, he was editing the script and forgot to replace the $PATH token in the export statement.  I've made that mistake myself.
0
 
LVL 5

Assisted Solution

by:arvind
arvind earned 50 total points
ID: 16967110
type following on root prompt

export PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/opt/jdk1.5.0_07/bin


0
 
LVL 9

Author Comment

by:ddlam
ID: 16970744
Thanks all nice guys very much. I am ready to reinstall whole system but your answers sloves my big troubles.

I set the path
PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/games:/opt/www/htdig/bin:/usr/lib/java/bin:/usr/lib/java/jre/bin:/opt/kde/bin:/usr/lib/qt/bin:/usr/share/texmf/bin:/opt/jdk1.5.0_07/bin

then correct ~/.bashrc

It works fine now.
0
 
LVL 11

Expert Comment

by:kblack05
ID: 16970795
I'm not sure why you would want to re-install the system...

Another handy trick here is to use the 'env' command piped to less

env | less

or even to grep

env | grep -i PATH

You would have seen that the path looked very short before.

Thanks and good luck!
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question