vi 出错解决方法

使用vi的时候如果出现以下错误

(1) Another program may be editing the same file.

    If this is the case, be careful not to end up with two

    different instances of the same file when making changes.

    Quit, or continue with caution.


(2) An edit session for this file crashed.

    If this is the case, use ":recover" or "vim -r httpd.conf"

    to recover the changes (see ":help recovery").

    If you did this already, delete the swap file ".httpd.conf.swp"

    to avoid this message.

解决方法:

(1)杀掉vi进程

[root@localhost conf]# ps -ef|grep vi

root      1751  1528  0 19:59 pts/1    00:00:00 vi /etc/httpd/conf/httpd.conf

root      1865  1770  0 21:00 pts/0    00:00:00 grep vi

[root@localhost conf]# kill -9 1751

(2)删除swp缓存文件

[root@localhost /]# find -name .httpd.conf.swp

./etc/httpd/conf/.httpd.conf.swp

[root@localhost /]# cd /etc/httpd/conf/

[root@localhost conf]# rm -rf .httpd.conf.swp

备注:该博文为原创博文,如果转发请注明出处。(max.li)


使用 `yum install lrzsz -y` 命令安装 `lrzsz` 出错可能有多种原因,以下是针对不同错误情况的解决办法: ### Centos 6 因官方停止维护更新且下架源导致的错误 报错信息可能类似“Cannot find a valid baseurl for repo: base”。解决步骤如下: 1. 切换到 `/etc/yum.repos.d` 目录: ```bash cd /etc/yum.repos.d ``` 2. 备份 `CentOS-Base.repo` 文件: ```bash mv CentOS-Base.repo CentOS-Base.repo.backup ``` 3. 编辑 `CentOS-Base.repo` 文件: ```bash vi CentOS-Base.repo ``` 在 `vi` 编辑器内输入以下内容: ```plaintext [centos-office] name=centos-office failovermethod=priority baseurl=https://vault.centos.org/6.10/os/x86_64 gpgcheck=1 gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6 ``` 4. 再次运行安装命令: ```bash yum install lrzsz -y ``` 至此,该报错问题可解决 [^2][^5]。 ### 因 `fastestmirror` 插件或源文件问题导致的错误 可尝试以下操作: ```bash sed -i "s|enabled=1|enabled=0|g" /etc/yum/pluginconf.d/fastestmirror.conf mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup curl -o /etc/yum.repos.d/CentOS-Base.repo https://www.xmpan.com/Centos-6-Vault-Aliyun.repo yum clean all yum makecache ``` 之后再运行 `yum install lrzsz -y` 进行安装 [^3]。 ### 因 yum 安装的源地址不对导致的 404 错误 报错信息可能类似“[Errno 14] PYCURL ERROR 22 - “The requested URL returned error: 404 Not Found””。需要更改源地址,以 163 源为例,操作步骤如下: 1. 切换到 `/etc/yum.repos.d` 目录: ```bash cd /etc/yum.repos.d ``` 2. 备份 `CentOS-Base.repo` 文件: ```bash mv CentOS-Base.repo CentOS-Base.repo.backup ``` 3. 下载 163 源配置文件: ```bash wget http://mirrors.163.com/.help/CentOS6-Base-163.repo ``` 4. 将下载的文件重命名为 `CentOS-Base.repo`: ```bash mv CentOS6-Base-163.repo CentOS-Base.repo ``` 5. 清理缓存: ```bash yum clean all ``` 之后再尝试安装 `lrzsz` [^4]。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值