梦在远方,路在脚下
posts - 2, comments - 1, trackbacks - 0, articles - 8

linux文件查看命令集

Posted on 2009-01-19 18:19 栗衙 阅读(282) 评论(0)  编辑  收藏
cat由第一行开始显示文件内容
tac
从最后一行开始显示
nl
显示同时输出行号
more
一页一页的显示内容
less
more类似,但其优点是,可以往前翻页
head
只看头几行
tail
只看未尾几行
od
以二进制的方式读取文件内容

cat[-n]
-n
连行号一起输出到屏幕上nl相似

more[
文件名]
more test.txt
test.txt一页一页的显示出来
ls -al | more
ls显示的内容一页页显示出来

less[
文件名]
less
的用法比more更有弹性,使用less可以用pageuppagedown翻看
less test.txt
/word
test.txt中搜寻word这个字符串
q
:退出less

head[-n number] [
文件名]
-n
显示number
head -n 20 test.txt
显示test.txt20

tail [-n number] [
文件名]
-n
显示number

tail -n 20 test.txt
显示test.txt20


head -n 20 test.txt | tail -n 10
11-20

只有注册用户登录后才能发表评论。


网站导航: