Linux查看文件内容三个常用命令

版权声明:https://mp.csdn.net/configure https://blog.csdn.net/jieniyan2680/article/details/88321971
  1. cat 文件名
    cat -b 对非空输出行编号
    cat -n 对输出的所有行编号

  2. more 文件名 (可以分屏显示)在这里插入图片描述

  3. grep 搜索文本文件名

例如 找123.txt 中hello

图形界面图形界面 CTRL+f 直接搜索就行 hello
-n
在终端 grep -n hello 123.txt (显示匹配行及行号)

-v
grep -v hello 123.txt (所有不包含hello的行都显示)
grep -vn hello 123.txt (所有不包含hello的行和行号都显示)

-i
grep -i (搜索不区分大小写的内容)
grep -in “hello python” 123.txt (所有包含hello python的行和行号都显示)

^a 首行,搜索以a 开头的行
ke$ 行尾,搜寻以ke结束的行

猜你喜欢

转载自blog.csdn.net/jieniyan2680/article/details/88321971
今日推荐