LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-22-2009, 01:27 PM   #1
Lindz
LQ Newbie
 
Registered: Sep 2009
Posts: 5

Rep: Reputation: 0
Unhappy PATH set incorrectly and lost bash: vi command... how can I change .bashrc?


Hi im new to linux. Im trying to install a software and wrote the PATH in the .bashrc file. However, I followed someone elses hand written example (taken from their computer elsewhere) however they left out the $PATH command, for example:

PATH=/pathdestination/
export PATH

Since then I have lost all my bash commands, ls, vi, su, sudo etc. when I type in echo $PATH I get:

/pathdestination/ (from the above example) but that is it.

I can go to the directory containing the .bashrc file however I can't open it to view using 'vi bashrc' I just get:

bash:vi:command not found

When I try to access using root 'su' or 'su -' I also get

bash:su:command not found

So I'm stuck as to how to modify the .bashrc file. Could someone please help me?

Thanks in advance

Lindsay
 
Old 09-22-2009, 01:31 PM   #2
mobinskariya
Member
 
Registered: Sep 2007
Location: Kerala, India
Distribution: ubuntu 10.04
Posts: 367

Rep: Reputation: 55
just delete the newly added line from .bashrc and relogin.
 
Old 09-22-2009, 01:40 PM   #3
Lindz
LQ Newbie
 
Registered: Sep 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Hi,

I would only but i cant open the .bashrc file to delete it cos the command 'vi .bashrc' doesnt work. I just get:

bash:vi:command not found

Im new to all this so is there another access to that file that can let me do that. 'pico' and 'joe' dont work cos iv already tried those as well (just incase)
 
Old 09-22-2009, 01:45 PM   #4
mobinskariya
Member
 
Registered: Sep 2007
Location: Kerala, India
Distribution: ubuntu 10.04
Posts: 367

Rep: Reputation: 55
so you are in cli.. then give the absolute path to vi command
Code:
/usr/bin/vi .bashrc
 
Old 09-22-2009, 01:47 PM   #5
j_jerry
Member
 
Registered: Sep 2009
Distribution: fedora 11
Posts: 318

Rep: Reputation: 46
Its because vi is no installed. Install vi or open in another editor. Also remember to include entire path to the file; like vi /home/YOU/.bashrc

Last edited by j_jerry; 09-22-2009 at 01:49 PM.
 
Old 09-22-2009, 01:48 PM   #6
Lindz
LQ Newbie
 
Registered: Sep 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Thank you very much

vi was installed as I had used it all afternoon. Just completely lost everything with two lines of incorrect code! Scary linux!

Last edited by Lindz; 09-22-2009 at 01:50 PM.
 
Old 09-22-2009, 01:50 PM   #7
mobinskariya
Member
 
Registered: Sep 2007
Location: Kerala, India
Distribution: ubuntu 10.04
Posts: 367

Rep: Reputation: 55
which reply did you find helpful??

edit:@j_jerry i assumed that vi is installed and the problem was due to $PATH

Last edited by mobinskariya; 09-22-2009 at 01:51 PM.
 
Old 09-22-2009, 01:55 PM   #8
j_jerry
Member
 
Registered: Sep 2009
Distribution: fedora 11
Posts: 318

Rep: Reputation: 46
@mobinskariya

Quote:
Originally Posted by Lindz View Post
Thank you very much

vi was installed as I had used it all afternoon. Just completely lost everything with two lines of incorrect code! Scary linux!
he made it clear; but i wonder how he got command not found
 
Old 09-22-2009, 01:57 PM   #9
mobinskariya
Member
 
Registered: Sep 2007
Location: Kerala, India
Distribution: ubuntu 10.04
Posts: 367

Rep: Reputation: 55
because his $PATH was altered..

@Lindz in future if you want to add a new path to your $PATH do as following
Code:
$PATH=/your/path:$PATH
/your/path is searched first for your command and then rest.
Code:
$PATH=$PATH:/your/path
now you know what above code means.

regards
mobin

Last edited by mobinskariya; 09-22-2009 at 02:00 PM.
 
Old 09-23-2009, 04:00 AM   #10
Lindz
LQ Newbie
 
Registered: Sep 2009
Posts: 5

Original Poster
Rep: Reputation: 0
I knew vi was already installed so i was saying thanks for how to open vi by using the full path '/usr/bin/vi .bashrc' ( I am so new I didnt even no that!) I already knew what to write for the $PATH only I copied someones else who wrote it quickly not thinking and then it went pear shaped!

However, I do actually think there may be a bigger problem. Iv come back into work and reset my linux entering as myself and the root but the screen has gone from the red hat desktop with tool bars etc to a pale blue screen with only a command prompted and a clock in the top corner. Its dual booted so im working on my windows version for the time being hoping this will ring a bell to anyone?
 
Old 09-23-2009, 06:01 AM   #11
Lindz
LQ Newbie
 
Registered: Sep 2009
Posts: 5

Original Poster
Rep: Reputation: 0
Managed to solve it by putting in the first disc of the red hat CD and carrying out a rescue. It was the only way it would let me open up the file as even writing the full location of 'vi' would not work.

Thanks again

Lindsay
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in set the $PATH and $CLASSPATH in my .bashrc htamayo Linux - Newbie 5 04-10-2009 07:43 AM
set up java_home path in /home/user/.bashrc but use path in /usr/lib/java vitalstrike82 Slackware 4 01-14-2009 12:25 AM
Setting path: /etc/profile, /etc/bashrc or ~/.bashrc Swakoo Linux - General 1 08-07-2007 11:59 PM
Is this a valid command? find ./ -name bash.bashrc | cat davidas Linux - Newbie 11 04-06-2004 03:16 AM
how to set command path okiyani Linux - General 1 03-04-2004 08:57 PM


All times are GMT -5. The time now is 11:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration