别着急,坐和放宽
-f
,当文件内容更新后,显示内容同步更新cat /etc/passwd # 可以同时查看多个文件
head /etc/passwd # 默认显示10行
head -5 /etc/passwd
tail /etc/passed # 默认显示10行
tail -5 /etc/passed
# 在/root目录运行脚本
# chmod +x countor.sh
# ./countor.sh &
tail -f /tmp/demo # ctrl+c退出
-l
,统计文件行数wc -l /tmp/demo
cat /tmp/demo | more
备份 -》 恢复
磁盘
c
表示打包f
表示打包成文件x
表示解包C
表示解包位置退出
退出 :q
强制退出 :q!
保存退出 :wq
保存到指定文件 :w /tmp/text2
强制保存退出 :wq!
行号
设置行号 :set nu
取消行号 :set nonu
高亮显示
n
移到下一个,按N
移到上一个tar cf /tmp/etc-backup.tar /etc
ls -lh /tmp/etc-backup.tar
tar czf /tmp/etc-backup.tar.gz /etc # gzip压缩
tar cjf /tmp/etc-backup.tar.bz2 /etc # bzip2压缩
tar xf /tmp/etc-backup.tar -C /root
tar xzf /tmp/etc-backup.tar.gz -C /root
vi /tmp/test # 新建一个文本文件
# 默认进入为普通模式
# 按 i 或 a 进入插入模式
# 按 ESC键 退回普通模式
# 按 : 进入末行模式