首页 技术 正文
技术 2022年11月16日
0 收藏 814 点赞 4,120 浏览 2079 个字

一、查看文件—–cat (详情参考:http://blog.sina.com.cn/s/blog_52f6ead0010127xm.html)

    语法结构: cat 查看方式 文件

    cat  -A   :  show all 显示所有内容,相当于-vET

[root@localhost tmp]# cat -A  /etc/profile
#注释:查看/erx/目录下profile文件的内容

   

   cat -b  :对非空白行惊醒编号

[root@localhost tmp]# cat -b  /etc/profile
注释:注:查看/etc/目录下的profile内容,并且对非空白行进行编号,行号从1开始;

  

  cat -E :show end在每行结束的位置显示$

[root@localhost tmp]# cat -E^C/etc/profile
#注:查看/etc/下的profile内容,并且在每行的结尾处附加$符号

  cat -n

[root@localhost tmp]# cat -n  /etc/profile
#注释:注:对/etc目录中的profile的所有的行(包括空白行)进行编号输出显示;

    

  cat -T 将tab显示为^T

  cat -v :列出一些看不来的特殊字符

二、文件查看—–nl命令

  文件文字为text.txt,作为测试文件

for i in range(10):
print("大傻瓜")list=[1,2,3,4,5,6,7,8]
for i in list:
print(i)ok!
list=[1,2,3,4,5,6,7,8]
for i in list:
print(i)ok!

 

   1、 -b 模式下的操作:(是否显示空白行的行号)

      -b  a:表示不论是否有空行,也同样列出行号

[root@localhost a]# nl -b a text #显示包括空白行的行数
1 for i in range(10):
2 print("大傻瓜")
3
4
5
6 list=[1,2,3,4,5,6,7,8]
7 for i in list:
8 print(i)
9
10
11
12 ok!
13 list=[1,2,3,4,5,6,7,8]
14 for i in list:
15 print(i)
16
17
18
19 ok!
20
21
22

  

    -b  t:不现实空白的行数,计算中跳过空白行

[root@localhost a]# nl -b t text #显示有效行数
1 for i in range(10):#
2 print("大傻瓜") 3 list=[1,2,3,4,5,6,7,8]
4 for i in list:
5 print(i) 6 ok!
7 list=[1,2,3,4,5,6,7,8]
8 for i in list:
9 print(i) 10 ok!

 

   2、-n模式:

     -n ln  :行号显示在屏幕的最左侧

[root@localhost a]# nl -n ln text#行号显示在左边
1 for i in range(10):
2 print("大傻瓜")3 list=[1,2,3,4,5,6,7,8]
4 for i in list:
5 print(i)6 ok!
7 list=[1,2,3,4,5,6,7,8]
8 for i in list:
9 print(i)10 ok!

   

     -n rn  :行号显示在屏幕的最右侧

[root@localhost a]# nl -n rn text  #显示在屏幕的最右侧
1 for i in range(10):
2 print("大傻瓜") 3 list=[1,2,3,4,5,6,7,8]
4 for i in list:
5 print(i) 6 ok!
7 list=[1,2,3,4,5,6,7,8]
8 for i in list:
9 print(i)

   

     -n rz  :行号显示在屏幕的最右侧,前面加0  


000001    for i in range(10):
000002 print("大傻瓜")000003 list=[1,2,3,4,5,6,7,8]
000004 for i in list:
000005 print(i)000006 ok!
000007 list=[1,2,3,4,5,6,7,8]
000008 for i in list:
000009 print(i)000010 ok!

    3、-w模式:缩进多少位

[root@localhost a]# nl -w 40 text
1 for i in range(10):
2 print("大傻瓜") 3 list=[1,2,3,4,5,6,7,8]
4 for i in list:
5 print(i) 6 ok!
7 list=[1,2,3,4,5,6,7,8]
8 for i in list:
9 print(i) 10 ok!

三、查看文件操作—–more(一页一页翻动)

  格式: more 【文件】

  1、空格:向下翻一页

  2、回车:向下翻一行

  3、“/” :搜索

  4、:f :立刻显示文件名和行数

  5、b:翻到第一页

  6、q:离开

四、查看文件——less(一页一页翻动)

  1、空格:向下翻一页

  2、pagedown:下一页

  2、pageup:上一页

  4、n:重复前一个搜索

  5、N:反方向反复前一个搜索

  6、q:退出

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:8,965
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,486
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,331
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,114
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,747
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,781