vim,压缩解压缩

(1)vim,vi;sed
vi,vim,<----->sed (文本编辑工具)
sed (非交互式的流处理文本编辑工具)
vi,vim(交互式的文本编辑工具)

(2)为啥使用vi,vim
linux文本处理工具很多(vim,vi,Emacs)
a.类unix系统使用vi,vim
b.程序调运
[root@localhost ~]# visudo
[root@localhost ~]# crontab -e
c.具有程序编辑的能力,可以辨别颜色
[root@localhost ~]# mv vimrc-anliu .vimrc
d.程序简单,速度快

(3)vim 三种模式 (命令模式,插入模式,末行)

命名模式----i,o,O,A,a---->插入模式
<--------ESC-----------

命令模式------------:-------> 末行
<-----------ESC-------------

命令模式:
翻页:pgup,pgdn,ctrl +F,B
光标移动:
上下左右键;h—>左;j—>下;k---->上;l----->右
w:下一个词首
e:
b:

行内:到行首 home,^ ,0
到行尾 end,$

行间:到首行 gg ,1G
到行 ,nG
到末行,G

删除:删除单个字符 x,del
删除光标所在行,dd
删除多行,3dd

复制,粘贴
yy,3yy
p(下),P(上)

查找
/word (从上往下)
?word(从下往上)
n :从前往后查看查找出的内容
N:从后往前查看查找出的内容

插入模式
i,I :i—>在光标前插入,I—>在光标所在行的行首
a,A:a—>在光标后插入,A—>在光标所在行的行尾
o,O:o—>在光标下一行插入,O—>光标上一行

末行模式
:15 跳到15行
:w
:q
:wq
:w!
:q!
:wq!
:e ~/filename 打开filename编辑
:r ~/filename 读入
:w ~/filename 另存为
替换
:s/old/new 光标所在行的第一个匹配内容
?/old/new/g 光标所在行的所有匹配内容
:2,5 s/old/new 2,5行的第一个匹配内容
:2,5 s/old/new/g 2,5行的所有匹配内容
:% s/old/new/g 所有匹配内容(全文)
:s/old/new/c 交互

(4)vim 命令打开文件

vim +15 filename
vim + filename
vim +/error filename #匹配的是光标下的第一行

(5)基本操作
v:按字符选
V:按行选取
ctrl+v : 块

.重复上一次操作

u:撤销
ctrl+r:撤销上一次撤销的内容

(5)末行模式配置
~/.viminfo ---->vim的末行历史命令
~/.vimrc ----->vim配置文件

压缩解压缩

(1)zip,unzip
zip filename.zip file
zip -r filename.zip dir
zip -m filename.zip file
zip filename.zip dir -x file
zip -d filename.zip file

unzip filename.zip
unzip fillename.zip /root/
unzip -n filename.zip /root/
unzip -o filename.zip /root/
unzip -v filename.zip

(2)gzip,gunzip
gzip *
gzip -r /test #该目录下的文件压缩
gzip -d
[root@server01 test]# gzip -l test2.gz
[root@server01 test]# gzip -dv test2.gz

(3)bzp2,bunzip2

bzip2压缩文件,将删除源文件。
压缩后的文件名为XXX.bz2存在,再次压缩时,不提示文件存在,没有压缩;要实现压缩,添加参数 -f强制压缩。
压缩后的文件名不是.bz2结尾,再次压缩式,不输出内容,已经压缩。

[root@server01 test]# bzip2 -d test3.bz2
bzip2: Output file test3 already exists.
[root@server01 test]# ls
123.out 1.zip 456.out dir1 dir2.zip test1 test1.zip test1zip.zip test2 test2.zip test3 test3.bz2 test3.zip test4 test5
[root@server01 test]# cat test3
[root@server01 test]# bzip2 -df test3.bz2
[root@server01 test]# cat test3
this is a test of test3

[root@server01 test]# bzip2 -dv test3.bz2
test3.bz2: done
[root@server01 test]# bzip2 -v test2
test2: 0.448:1, 17.867 bits/byte, -123.33% saved, 30 in, 67 out.

[root@server01 test]# bzip2 -t test2.bz2
[root@server01 test]# bzip2 -tv test2.bz2
test2.bz2: ok

[root@server01 test]# bzip2 -k test3

(4)xz,unxz

归档(打包)

(1)tar
tar xf exam.tar ;rm -rf exam.tar #解压并删除源文件
(2)cpio

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值