0
点赞
收藏
分享

微信扫一扫

linux回炉第四天

vim
i
a
o
I
A
O
ESC
:wq
:q!
ZZ
ZQ
vimdiff

:r cat ~/.bashrc
:.! cat ~/.bashrc| grep ^alias
:!hostname
:r!hostname
r! 会将命令的输出结果粘贴到当前行下方
.! 会将命令的输出结果替换当前行

:1   #第一行
:$ #最后一行
:$-1 #倒数第二行
:% #全文

:?root
:1,7s/root/ROOT/ #替换1到7行每行的第一个root为ROOT
:%s/root/ROOT/g #替换全文所有root为ROOT
:%s/root/ROOT/gi #替换全文所有root为ROOT,并忽略大小写
:/adm/,/games/s/root/ROOT/g #替换adm开头的行到games开头行之间的root替换为ROOT
:%s/\<root\>/ROOT/g #\<root\>是正则里的位置锚定,root为整个单词

:set list
:set nolist
:set hlsearch
:set nohlsearch
:syntax on
:sytax off

dd
5dd
d$
dG
dgg
d0
d^
D
C
yy
5yy
p
P

u
U
ctrl+r
!e
. #重复前一次动作
5. #重复5次前一次动作

ctrl+v
大写V
小写v

~]# vim mima issue
~]# vim -o issue mima
~]# vim -O issue mima
:qa!
ctrl+w+方向键

cat -E mima.txt    # 显示结束符$
cat -A mima.txt # 显示所有控制符
cat -n mima.txt # 显示所有行号
cat -b mima.txt # 显示非空行行号
cat -s mima.txt # 压缩连续空行为一行

nl mima.txt

tac mima.txt
seq 10 | tac

rev mima.txt

head -3 mima.txt
head -n3 mima.txt
head -n +3 mima.txt
head -n -3 mima.txt
head -c 10 mima.txt
head -n 20 mima.txt | tail

tail -f /var/log/messages
watch -n .1 cat /var/log/secure
tail -F /var/log/secure

cut -d: -f1,3 passwd
cut -d: -f1,3 --output-delimiter=--- passwd
cut -c1 passwd
cut -c1,3 passwd
cut -c1-6 passwd

paste user.txt pass.txt
paste user.txt pass.txt -d:

wc -l
wc -c
wc -w
wc -m

sort
sort -r
sort -rn
sort -nu
~]# cut -d: -f1,3 passwd|sort -t: -k2 -rn


举报

相关推荐

第四天 作业

Rhcsa第四天

第四天笔记

HCIP 第四天

第四天记录

DOM第四天

0 条评论