2019-04-08第三周Day1

vim故障原因及解决办法;

当进行vim编辑时出现下图时;

E325: ATTENTION
Found a swap file by the name "/tmp/.1.txt.swp"
          owned by: root   dated: Mon Apr  8 13:54:42 2019
         file name: /tmp/1.txt
          modified: YES
         user name: root   host name: fendou
        process ID: 7744
While opening file "/tmp/1.txt"
             dated: Mon Apr  8 13:52:14 2019

(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 /tmp/1.txt"
    to recover the changes (see ":help recovery").
    If you did this already, delete the swap file "/tmp/.1.txt.swp"
    to avoid this message.

Swap file "/tmp/.1.txt.swp" already exists!
[O]pen Read-Only, (E)dit anyway, (R)ecover, (D)elete it, (Q)uit, (A)bort:

vim执行过程是;

image.png

原因是; - 1.同时打开1个文件 2.之前的文件没有正常保存退出 导致的

解决办法;1.删除这个临时文件(推荐)

错误提示中 有这个文件的名字

2.把临时文件的内容恢复(不推荐)

配置别名;

配置别名格式为;alias+小名=‘命令’

1.临时有效的

[root@oldboyedu59 ~]# alias net='cat /etc/sysconfig/network-scripts/ifcfg-eth0'
[root@oldboyedu59 ~]# net
TYPE=Ethernet
BOOTPROTO=none
NAME=eth0
UUID=fa77146b-1e0c-4544-8ecb-5a98a6ebfc41
DEVICE=eth0
ONBOOT=yes
IPADDR=10.0.0.201
PREFIX=24
GATEWAY=10.0.0.254
DNS1=10.0.0.254
DNS2=223.5.5.5

永久 /etc/profile

[root@oldboyedu59 ~]# tail -1 /etc/profile
alias net='cat /etc/sysconfig/network-scripts/ifcfg-eth0'
让配置生效
[root@oldboyedu59 ~]# source  /etc/profile

检查


[root@oldboyedu59 ~]# alias net
alias net='cat /etc/sysconfig/network-scripts/ifcfg-eth0'

grep;文本过滤工具

grep 参数;

-n 显示行号和内容
-w 按照单词进行过滤
-i 过滤的时候忽略大小写
-v 排除/取反

tr; 替换 1对1替换 (大小写切换) 与<连用(<输入重定向符号)

WFRN_$OCEBZT.png
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 官网 中文版本 好的网站 Content-type: text/htmlBASH Section: User ...
    不排版阅读 4,464评论 0 5
  • 住alt键+鼠标 ######msg-icp 29/tcp # MSG ICP #####...
    小孟灬阅读 222评论 0 0
  • 一、vim故障 1. vim执行过程 2. 故障产生原因 1.同时打开1个文件2.之前的文件没有正常保存退出 导致...
    七两三_e13f阅读 288评论 0 0
  • 基本命令-2 压缩和归档 打包: 即归档,类似于旅游之前收拾行李 压缩: 为了减少占用的磁盘空间,可以做备...
    崔千易阅读 968评论 0 0
  • 生活有时候就像正在融化的雪糕,虽然很甜,却让你无法静心享受。 不知道你们有没有这样的经历,正在吃着的雪糕融化了,流...
    孙大猫阅读 837评论 1 4