- 创建文本:touch
touch test.txt
- 查看文本内容:cat/tac(但是不适合看有很多页的文件)
cat test.txt
# -n 显示行号
cat -n test.txt
# tac就是cat的倒着显示
- 查看文本内容命令2:more(空格或f是翻页,enter换行,q或者Q退出)
more test.txt
- 查看文本内容命令3:less(page_up/page_down可以翻上下页,/ 可以查询关键字)
less test.txt
- 指定查看开头的内容:head(默认显示前10行)
head test.txt
head -n 7 test.txt
- 指定查看结尾的内容:tail(默认显示前10行)
tail test.txt
tail -n 3 test.txt
# 动态查看末尾的信息
tail -f test.txt