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执行过程是;
原因是; - 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 排除/取反