Solved

/root/.bashrc error

Posted on 2006-06-22
8
1,090 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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

696 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