Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-02-2016, 09:23 AM   #1
LQ Newbie
Registered: Dec 2013
Posts: 24

Rep: Reputation: Disabled
.bash_profile path error

Hi, I modified .bash_profile file and now the terminal is not working, for exemplo:

# vi
bash: vi: command not found
# ls -l /usr/bin/vi
bash: vi: command not found

I backed .bash_profile file but the terminal not found the commands, so please, can you help please?, how can I restore the .bash_profile
Old 02-02-2016, 09:48 AM   #2
LQ Guru
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138Reputation: 2138
export PATH=/bin:/usr/bin:/usr/local/bin
That'll get your PATH running, and then you can fix the file as needed.

Next time you're playing with the login scripts, I suggest leaving one terminal open, and using a second to test whether or not it works. That way if you screw something up, you still have the original terminal you can use to fix things.
1 members found this post helpful.
Old 02-02-2016, 10:16 AM   #3
LQ Newbie
Registered: Dec 2013
Posts: 24

Original Poster
Rep: Reputation: Disabled
.bash_profile path error

I fix the file as needed and now it's ok.

Old 02-02-2016, 10:26 AM   #4
Registered: May 2009
Location: Leeds Uk
Distribution: Linux Mint 19.2
Posts: 127

Rep: Reputation: 16
I think you have done a little more than that.
Vi is a symbolic link
/usr/bin/vi -> /etc/alternatives/vi
Im assuming all the other commands work.

Type the following....

You should see vi

Replace symbolic link

ln -s /etc/alternatives/vi /usr/bin/vi

Please State distribution (What kind Linux you are using).
Old 02-02-2016, 10:54 AM   #5
Senior Member
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062Reputation: 1062
You may notice that /usr/bin/vi is a symbolic link to /usr/bin/elvis on many systems. If so, you may want to replace that symbolic link to /usr/bin/vim, vi improved.

You can find out if you
ls -al /usr/bin/vi
lrwxrwxrwx 1 root root 5 Nov 11  2014 /usr/bin/vi -> elvis*
elvis is a clone of the ex/vi editor.

Also, a couple of handy things you can add to your profile that enhance vi (all flavors of vi); add a file to your home directory named .exrc with this content:
set autoindent showmode showmatch
  • autoindent. When you type a tab (to indent code and the like), the editor will continue to indent for you until you type a ctrl-D which will undent. You can type multiple tabs (and multiple undents), make for more readable code.
  • showmode. Shows at the bottom of the screen what mode you're in (edit, replace, etc.). Not real useful but not a complete waste either.
  • showmatch. When you're typing parens, braces or brackets -- (), {}, [] -- if you miss a closing paren, brace or bracket you'll get a visual indication that you need to add one (or more). Handy if you're doing coding.
Can't hurt, might help.

Hope this helps some.


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
give path in bash_profile.?? abi Linux - Newbie 3 02-04-2012 04:43 AM
Adding a Path to .bash_profile nexisrocks Linux - Newbie 4 06-20-2007 07:54 PM
kde3.2 $PATH and .bash_profile easywebdev Slackware 2 03-29-2004 04:42 PM
kshell in path & .bash_profile dmartinez Linux - Newbie 3 03-31-2003 10:15 PM
.bash_profile & path Syncrm Linux - General 11 01-30-2002 01:49 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:24 PM.

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