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 - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-09-2009, 01:28 PM   #1
shankars02
LQ Newbie
 
Registered: Jan 2009
Posts: 1

Rep: Reputation: 0
bash: vi:command not found


i am new to linux.i am unable to open the vi text editor. whenever i type vi i get
bash: vi:command not found

what shall i do. please help me out with this


thank you
shankar
 
Old 01-09-2009, 01:30 PM   #2
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,979
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Quote:
Originally Posted by shankars02 View Post
i am new to linux.i am unable to open the vi text editor. whenever i type vi i get
bash: vi:command not found

what shall i do. please help me out with this


thank you
shankar
Cannot help if you don't supply the version of linux you are using.

-C
 
Old 01-09-2009, 03:35 PM   #3
deesto
Member
 
Registered: May 2002
Location: NY, USA
Distribution: FreeBSD, Fedora, RHEL, Ubuntu; OS X, Win; have used Slackware, Mandrake, SuSE, Xandros
Posts: 448

Rep: Reputation: 31
shankar, if you are new to Linux, are you also new to vi? If so, you may want to try a more "newbie-friendly" text editor, such as the Gnome-based GEdit for starters.

If you are set on using vi, try these and see if anything returns with a positive response:

Code:
which vi
ls -l /usr/bin/vi
ls -l /bin/vi
If any of these return a path to 'vi', you need to add that path to your $PATH variable in order to use it.
 
Old 01-09-2009, 03:53 PM   #4
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
deesto: which vi would only work if vi were listed as either an alias or a file within the $PATH environment.

shankars02: on most linux distributions vi is an alias to vim. This is typically /usr/bin/vim.

Try:
Code:
vim
echo $PATH
As a last resort:
Code:
find / -name 'vi*' 2>/dev/null
 
Old 01-09-2009, 04:13 PM   #5
deesto
Member
 
Registered: May 2002
Location: NY, USA
Distribution: FreeBSD, Fedora, RHEL, Ubuntu; OS X, Win; have used Slackware, Mandrake, SuSE, Xandros
Posts: 448

Rep: Reputation: 31
Quote:
Originally Posted by Disillusionist View Post
deesto: which vi would only work if vi were listed as either an alias or a file within the $PATH environment.
Doh ... right ... how about instead:
Code:
locate vi
 
Old 01-10-2009, 03:37 AM   #6
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
Well, yes locate vi would find vi/vim but have you tried it?

Code:
locate vi|wc -l
On my system the above command returns 10421

That's over ten thousand files that contain the letters vi within them!

locate doesn't allow you to specify that vi is the complete name, but find does:
Code:
find / -name 'vi' 2>/dev/null
find / -name 'vim' 2>/dev/null
These should only produce a small list of available options.

Assuming vim is in /usr/bin you can create an alias with:
alias vi=/usr/bin/vim

To make the change permanent you need to add this to either the system-wide profile or your own user profile.

Last edited by Disillusionist; 01-10-2009 at 03:50 AM.
 
Old 01-10-2009, 04:13 AM   #7
openSauce
Member
 
Registered: Oct 2007
Distribution: Fedora, openSUSE
Posts: 252

Rep: Reputation: 39
Quote:
Originally Posted by Disillusionist View Post
Code:
locate vi|wc -l
On my system the above command returns 10421

That's over ten thousand files that contain the letters vi within them!

locate doesn't allow you to specify that vi is the complete name, but find does:
You can get the best of both worlds:
Code:
locate vi | egrep '\bvim?\b'
 
Old 01-10-2009, 05:14 AM   #8
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
Quote:
Originally Posted by openSauce View Post
You can get the best of both worlds:
Code:
locate vi | egrep '\bvim?\b'
did you mean:
Code:
locate vi | egrep '\/vim?$'
 
Old 01-10-2009, 05:17 AM   #9
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Hi,

Perhaps you are looking for vim
 
Old 01-10-2009, 06:09 AM   #10
openSauce
Member
 
Registered: Oct 2007
Distribution: Fedora, openSUSE
Posts: 252

Rep: Reputation: 39
Quote:
Originally Posted by Disillusionist View Post
did you mean:
Code:
locate vi | egrep '\/vim?$'
Even better!
 
Old 01-12-2009, 09:26 AM   #11
deesto
Member
 
Registered: May 2002
Location: NY, USA
Distribution: FreeBSD, Fedora, RHEL, Ubuntu; OS X, Win; have used Slackware, Mandrake, SuSE, Xandros
Posts: 448

Rep: Reputation: 31
I think it's safe to say that this post has strayed a bit from the original request ...

shankar, do you still need help using vi?
 
Old 06-09-2009, 03:41 PM   #12
kp3372
LQ Newbie
 
Registered: Jun 2009
Posts: 1

Rep: Reputation: 0
yes I need help
 
Old 06-09-2009, 03:57 PM   #13
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You could simply use your package manager and see if vim is installed. If not, install it.
The vi command will probably be installed as a symbolic link /bin/vi -> /bin/vim.

It would be helpful if you would put your distro in your user profile. Then you could get advice like "sudo zypper install vim" or "sudo yum install vim", for a quicker answer. But often the best advice depends on what distro you are using.

If you are working from a rescue image, there may be a vim-minimal available rather than vim, so save space.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
bash: command not found hamish Linux - Newbie 7 02-23-2011 04:28 PM
bash: g++: command not found m_lp_ql_m Linux - Software 8 07-08-2010 01:45 PM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-27-2006 11:57 PM
-bash: cp: command not found johnlittlepeap Fedora 2 11-15-2004 08:52 AM
bash: ll: command not found x2000koh Linux - Newbie 3 08-08-2003 05:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:28 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
Open Source Consulting | Domain Registration