LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-06-2014, 06:09 AM   #1
sagar666
Member
 
Registered: Feb 2013
Posts: 212

Rep: Reputation: Disabled
command not found


Hi

If i enter vi command or clear command i am getting following error
-bash: vim: command not found

This command are working fine in other users.Hope i will get solution.
 
Old 02-06-2014, 06:34 AM   #2
myatthu
Member
 
Registered: Jan 2014
Distribution: CentOS, Fedora, Ubuntu
Posts: 108

Rep: Reputation: 18
Most likely your .bash_profile is corrupted.
Since the other accounts are working, you may refer one of the working accounts profile.
 
Old 02-06-2014, 06:35 AM   #3
Isaac Velando
LQ Newbie
 
Registered: Feb 2014
Location: Texas
Distribution: Arch, Ubuntu Server, CentOS
Posts: 29

Rep: Reputation: 21
Can you try
Code:
/bin/which vim
/bin/echo $PATH
to see if the path to vim is located in your PATH environment variable? Typing
Code:
vim
into bash or another shell will cause bash to search in the directories in PATH for executables to run.

Last edited by Isaac Velando; 02-06-2014 at 06:44 AM.
 
Old 02-07-2014, 09:27 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by myatthu View Post
Most likely your .bash_profile is corrupted. Since the other accounts are working, you may refer one of the working accounts profile.
No, that is not "most likely"; it is ONE possibility; please don't jump to conclusions without having any evidence to support them. It is much MORE likely that (since it WAS working), that the OP has manually entered a command to modify their path, or that another shell script has been run that overwrote the PATH variable. Also, you say ".bash_profile"...but don't mention the .profile, or .bashrc, ALL of which may be involved here. Since you have 'certifications', haven't you studied which files get read when a user logs in?

OP, have you recently edited your system profile? Your user profile? (ANY of them?). Logging out/back in is the best first step, since that will reset ALL your environment variables. If it still doesn't work, then you can work around it initally, just by typing
Code:
export PATH="/bin:/usr/bin:/usr/sbin:/sbin"
..which will put most things back in your path (like vi, etc.), and let you diagnose the problem more easily.
 
1 members found this post helpful.
Old 02-09-2014, 09:19 AM   #5
honeybadger
Member
 
Registered: Aug 2007
Location: India
Distribution: Slackware (mainly) and then a lot of others...
Posts: 855

Rep: Reputation: Disabled
What I am thinking is when you enter 'vi' how come bash says 'vim not found'?
Something is wrong here.
 
Old 02-09-2014, 10:27 AM   #6
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by honeybadger View Post
What I am thinking is when you enter 'vi' how come bash says 'vim not found'?
Something is wrong here.
Perhaps, but on my openSUSE system /usr/bin/vi is a symbolic link to /usr/bin/vim.
 
Old 02-09-2014, 04:41 PM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
That's interesting....
On my Centos 6.5, vim is /usr/bin/vim and vi is purely an alias to vim (ie no /usr/bin/ entry).
iirc, last time I yum installed 'vi', it really does install /usr/bin/vi ie NOT a symlink to vim.

Guess different distros do it differently.

QN: what happens on openSUSE if you specifically(!) install 'vi'; do you get a real one?
 
Old 02-10-2014, 03:44 AM   #8
voleg
Member
 
Registered: Oct 2013
Distribution: RedHat CentOS Fedora SuSE
Posts: 354

Rep: Reputation: 51
yum install vim*
 
Old 02-10-2014, 08:37 AM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by chrism01 View Post
That's interesting....
On my Centos 6.5, vim is /usr/bin/vim and vi is purely an alias to vim (ie no /usr/bin/ entry). iirc, last time I yum installed 'vi', it really does install /usr/bin/vi ie NOT a symlink to vim.

Guess different distros do it differently. QN: what happens on openSUSE if you specifically(!) install 'vi'; do you get a real one?
Don't know. If I query the vi package through yast, it tells me that vi is part of the vim-base package, which is already installed. I presume I could install it from source, but then I'd have to remove the symlink.
 
Old 02-11-2014, 06:58 PM   #10
sagar666
Member
 
Registered: Feb 2013
Posts: 212

Original Poster
Rep: Reputation: Disabled
First of all i would like to say sorry for late response.

export PATH="/bin:/usr/bin:/usr/sbin:/sbin"

The above command resolves my problem.

Thanks a lot guys.
 
Old 02-12-2014, 12:16 AM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
@TB0ne: true but you could use an alias instead, thus giving you both options
 
Old 02-12-2014, 08:17 AM   #12
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,635

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by chrism01 View Post
@TB0ne: true but you could use an alias instead, thus giving you both options
Indeed, but I don't use either too much these days. I prefer kdevelop for my hard-core coding, and vim works fine for the random file.

However, back in the day.....
 
  


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] rpm command and yum command not found Joaquin Red Hat 28 10-28-2020 10:54 AM
[SOLVED] complete noob question. "command not found" "command not found" jeanlucpicard Linux - Newbie 4 08-27-2013 02:14 AM
setup command not found in Ubuntu 10.04 Command Prompt vinaytp Ubuntu 2 05-06-2010 01:10 PM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-27-2006 11:57 PM
bash: <command name> command not found smash Programming 5 03-13-2006 08:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:44 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