LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 06-05-2019, 09:09 AM   #1
noob2linux
LQ Newbie
 
Registered: Jun 2019
Posts: 4

Rep: Reputation: Disabled
Exclamation Screwed up bashrc


Hello

I'm unfortunately having a worse problem with the login and want to fix it.

I was able to login via ctrl + alt + f2 and was able to login to the terminal.

The cause was due to messing with the bashrc as well, so I wanted to fix it. But when I type the command I get "vim command not found"

I literally cannot open the bashrc which caused it. Is there a way to revert it or would I have to go through the recovery mode to fix it?
 
Old 06-12-2019, 03:45 AM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by noob2linux View Post
Hello

I'm unfortunately having a worse problem with the login and want to fix it.

I was able to login via ctrl + alt + f2 and was able to login to the terminal.

The cause was due to messing with the bashrc as well, so I wanted to fix it. But when I type the command I get "vim command not found"

I literally cannot open the bashrc which caused it. Is there a way to revert it or would I have to go through the recovery mode to fix it?
Welcome to LQ.
You really should've started your own thread for this.
But be that as it may: vim is just a text editor. you can just as well use nano or vi or even a graphical editor.
 
Old 06-12-2019, 09:29 AM   #3
wvermin
Member
 
Registered: Jun 2019
Posts: 34

Rep: Reputation: Disabled
rename .bashrc

If you can login using cntrl-alt-f2, just do that and rename the .bashrc, for example:

mv .bashrc p.bashrc

Then you should be able to login normally after a restart.
 
Old 06-12-2019, 09:33 AM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,728

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
You've (apparently) munged the PATH in your .bashrc, so just supply the absolute path to vim.
On my system:
Code:
/bin/vim ~/.bashrc
Fix your .bashrc and save it, then
Code:
. ~/.bashrc
 
Old 09-06-2019, 09:44 AM   #5
Lsatenstein
Member
 
Registered: Jul 2005
Location: Montreal Canada
Distribution: Fedora 31and Tumbleweed) Gnome versions
Posts: 311
Blog Entries: 1

Rep: Reputation: 59
unalias vim
and re-alias to vi.

Manually enter
alias vim=vi

now use vim or vi.
 
Old 09-06-2019, 10:59 AM   #6
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by Lsatenstein View Post
unalias vim
and re-alias to vi.

Manually enter
alias vim=vi

now use vim or vi.
we don't know what was messed up in ~/.bashrc

Probably PATH,
in which case your alias would not have worked.

However, had the full path been used
Code:
alias vim="/usr/bin/vim"
# or
alias vim="/usr/bin/vi"
obviously the correct path would need to be used.

and it would have been easier to just see if it was the path and fix that
Code:
echo $PATH
# examine 
export PATH=/usr/bin:$PATH
vim ~/.bashrc
 
Old 09-06-2019, 11:36 AM   #7
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
mv .bashrc bashrc.bk
log in then check it in the gui env. you can get to a web browser and search out bashrc setting etc... easier.

mod:
I just found @wvermin comment after post, yesh what he said too.

Last edited by BW-userx; 09-06-2019 at 11:37 AM.
 
Old 09-06-2019, 11:44 AM   #8
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
@bw-userx

yeah, mv ~/.bashrc would work

bit of a sledgehammer to crack a nut
Especially if it is just the PATH that got screwed.

OP has not been back, I assume fixed
and if any newbies stumble up this they will see why alias is not a solution unless done right
 
Old 09-06-2019, 11:51 AM   #9
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Firerat View Post
@bw-userx

yeah, mv ~/.bashrc would work

bit of a sledgehammer to crack a nut
Especially if it is just the PATH that got screwed.

OP has not been back, I assume fixed
and if any newbies stumble up this they will see why alias is not a solution unless done right
yeah but it is a quick fix , then just log in open it in a gui editor fix it and be done with it, here we have ahhhh I cannot open vi vim nothing is working ahhhhhhh panic .. that'd remove the panic... bashrc it is only needed when?

one could also do a cat .bashrc .. see the error then sed it to fix it.

Last edited by BW-userx; 09-06-2019 at 11:52 AM.
 
Old 09-06-2019, 12:00 PM   #10
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by BW-userx View Post
bashrc it is only needed when?
you login.. so
Edit: or start a bash shell

you mv ~/.bashrc ~/.bashrc-busted

logout \
---------or login on other console..
login /

meh, I'm too lazy for all that



Edit: I suppose you could just /bin/bash

or /bin/sh /bin/zsh ...

Last edited by Firerat; 09-06-2019 at 12:03 PM.
 
Old 09-06-2019, 01:01 PM   #11
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Firerat View Post
you login.. so
Edit: or start a bash shell

you mv ~/.bashrc ~/.bashrc-busted

logout \
---------or login on other console..
login /

meh, I'm too lazy for all that



Edit: I suppose you could just /bin/bash

or /bin/sh /bin/zsh ...
there's

/etc/bashrc and/or /etc/bash.bashrc you can copy over into home as .bashrc for the basic setup, back up old then copy that one over, then figure it out after login gui wm/dt
 
Old 07-23-2023, 11:38 PM   #12
noob2linux
LQ Newbie
 
Registered: Jun 2019
Posts: 4

Original Poster
Rep: Reputation: Disabled
Hey.

I just wanted to make an update on this thread. I kinda forgot about it.

How I fixed this was I logged in as root and accessed my user's .bashrc.

After I did that, I restarted my machine and that worked again.

Thanks for everyone who tried to help me out so many years ago.

Last edited by noob2linux; 07-23-2023 at 11:39 PM. Reason: wanted to say thanks
 
  


Reply



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
[SOLVED] /etc/bashrc ,dircolors and /root/.bash_profile ,/.bashrc not exist in LFS-7.5(sec9.3) jaassi Linux From Scratch 2 09-20-2014 05:04 PM
~/.bashrc, /etc/bash.bashrc files not read? Tachtory Slackware 3 01-04-2014 12:25 AM
[SOLVED] How to use my /home/kangjoo/.bashrc rather than root/.bashrc kangjoo.lee Linux - Newbie 2 11-05-2012 03:38 PM
.bashrc / .bash_profile /etc/profile /etc/bashrc deadeyes Red Hat 2 02-13-2010 11:22 AM
Setting path: /etc/profile, /etc/bashrc or ~/.bashrc Swakoo Linux - General 1 08-07-2007 10:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 09:26 AM.

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
Open Source Consulting | Domain Registration