vim 時出現 -bash: vim: command not found解決

來源:互聯網
上載者:User

用centos 的主機的時候, 用 vim 時出現 -bash: vim: command not found. 只能使用 vi. 那麼如何安裝 vim 呢?
輸入 rpm -qa|grep vim 命令, 如果 vim 已經正確安裝,會返回下面的三行代碼:
[root@centos]# rpm -qa |grep vim
vim-minimal-7.0.109-6.el5
vim-common-7.0.109-7.2.el5
vim-enhanced-7.0.109-7.2.el5

如果少了其中的某一條,比如 vim-enhanced 的,就用命令 yum -y install vim-enhanced 來安裝:
yum -y install vim-enhanced
如果上面的三條都沒有返回, 可以直接用 yum -y install vim* 命令
yum -y install vim*二。[root@localhost ~]# ll#部分省略了......-rwxr--r-- 1 root root 34 Apr 26 12:48 test.txt#用vim開啟test.txt檔案[root@localhost ~]# vim test.txt-bash: vim: command not found[root@localhost ~]##使用命令查詢[root@localhost ~]# rpm -qa | grep vimvim-minimal-7.0.109-6.el5#發現只有這個包,說明沒安裝完整,需要重新安裝vim#下面是安裝過程[root@localhost ~]# yum install -y vim*Loaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* addons: mirrors.grandcloud.cn* base: mirrors.grandcloud.cn* extras: mirrors.grandcloud.cn* updates: mirrors.grandcloud.cnSetting up Install ProcessResolving Dependencies--> Running transaction check---> Package vim-X11.x86_64 2:7.0.109-7.2.el5 set to be updated---> Package vim-common.x86_64 2:7.0.109-7.2.el5 set to be updated---> Package vim-enhanced.x86_64 2:7.0.109-7.2.el5 set to be updated---> Package vim-minimal.x86_64 2:7.0.109-7.2.el5 set to be updated--> Finished Dependency ResolutionDependencies Resolved========================================================================================Package Arch Version Repository Size========================================================================================Installing:vim-X11 x86_64 2:7.0.109-7.2.el5 base 1.0 Mvim-common x86_64 2:7.0.109-7.2.el5 base 6.4 Mvim-enhanced x86_64 2:7.0.109-7.2.el5 base 1.3 MUpdating:vim-minimal x86_64 2:7.0.109-7.2.el5 base 334 kTransaction Summary========================================================================================Install 3 Package(s)Upgrade 1 Package(s)Total download size: 9.1 MDownloading Packages:(1/4): vim-minimal-7.0.109-7.2.el5.x86_64.rpm | 334 kB 00:00 (2/4): vim-X11-7.0.109-7.2.el5.x86_64.rpm | 1.0 MB 00:03 (3/4): vim-enhanced-7.0.109-7.2.el5.x86_64.rpm | 1.3 MB 00:03 (4/4): vim-common-7.0.109-7.2.el5.x86_64.rpm | 6.4 MB 00:21 ----------------------------------------------------------------------------------------Total 314 kB/s | 9.1 MB 00:29 Running rpm_check_debugRunning Transaction TestFinished Transaction TestTransaction Test SucceededRunning TransactionInstalling : vim-common 1/5Installing : vim-X11 2/5Updating : vim-minimal 3/5Installing : vim-enhanced 4/5Cleanup : vim-minimal 5/5Installed:vim-X11.x86_64 2:7.0.109-7.2.el5 vim-common.x86_64 2:7.0.109-7.2.el5 vim-enhanced.x86_64 2:7.0.109-7.2.el5 Updated:vim-minimal.x86_64 2:7.0.109-7.2.el5 Complete!#安裝成功[root@localhost ~]# [root@localhost ~]# vim test.txt#進入vim操作介面#:q退出介面後,使用命令查看[root@localhost ~]# rpm -qa | grep vimvim-enhanced-7.0.109-7.2.el5vim-common-7.0.109-7.2.el5vim-X11-7.0.109-7.2.el5vim-minimal-7.0.109-7.2.el5

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.