美文网首页
软件测试基础知识-Linux篇(3)

软件测试基础知识-Linux篇(3)

作者: 燕窝Emily | 来源:发表于2021-04-01 15:49 被阅读0次

1.直接检视文件内容

1.cat

[root@study ~]# cat [-AbEnTv]
选项与参数:
-b : 列出行号, 仅针对非空白行做行号显示, 空白行不标行号!
-E : 将结尾的断行字符 $ 显示出来;
-n : 打印出行号, 连同空白行也会有行号, 与 -b 的选项不同;
-v : 列出一些看不出来的特殊字符

bogon:学习 yuyan$ cat hello.txt
hello from hogwarts

hello from sevenribyi

hello from testerhome
bogon:学习 yuyan$ cat -b hello.txt
     1  hello from hogwarts

     2  hello from sevenribyi

     3  hello from testerhome
bogon:学习 yuyan$ cat -e hello.txt
hello from hogwarts$
$
hello from sevenribyi$
$
hello from testerhome$
bogon:学习 yuyan$ cat -n hello.txt
     1  hello from hogwarts
     2
     3  hello from sevenribyi
     4
     5  hello from testerhome
bogon:学习 yuyan$ cat -v hello.txt
hello from hogwarts

hello from sevenribyi

hello from testerhome

2.nl (添加行号打印)

[root@study ~]# nl [-bnw] 文件

选项与参数:

b 指定行号指定的方式, 主要有两种****:

-b a : 表示不论是否为空行, 也同样列出行号( 类似 cat -n) ;

-b t : 如果有空行, 空的那一行不要列出行号( 默认值) ;

n 列出行号表示的方法, 主要有三种****:

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

-n rn : 行号在自己字段的最右方显示, 且不加 0 ;

-n rz : 行号在自己字段的最右方显示, 且加 0 ;

-w : 行号字段的占用的字符数。

bogon:学习 yuyan$ nl -b a  hello.txt
     1  hello from hogwarts
     2
     3  hello from sevenribyi
     4
     5  hello from testerhome
bogon:学习 yuyan$ nl -b t  hello.txt
     1  hello from hogwarts

     2  hello from sevenribyi

     3  hello from testerhome
bogon:学习 yuyan$ nl -b a -n rz  hello.txt
000001  hello from hogwarts
000002
000003  hello from sevenribyi
000004
000005  hello from testerhome
bogon:学习 yuyan$ nl -b a -n rz -w 3  hello.txt
001 hello from hogwarts
002
003 hello from sevenribyi
004
005 hello from testerhome

2.可翻页检视

1.more(一页一页翻动)

空白键 ( space) : 代表向下翻一页;

Enter : 代表向下翻“一行”;

/字串 : 代表在这个显示的内容当中, 向下搜寻“字串”这个关键字;

:f : 立刻显示出文件名以及目前显示的行数;

q : 代表立刻离开 more , 不再显示该文件内容。

b 或 [ctrl]-b : 代表往回翻页, 不过这动作只对文件有用, 对管线无用。

2.Less (一页一页翻动)

空白键 : 向下翻动一页;

[pagedown]: 向下翻动一页;

[pageup] : 向上翻动一页;

/字串 : 向下搜寻“字串”的功能;

?字串 : 向上搜寻“字串”的功能;

n : 重复前一个搜寻 ( 与 / 或 ? 有关! )

N : 反向的重复前一个搜寻 ( 与 / 或 ? 有关! )

g : 前进到这个数据的第一行去;

G : 前进到这个数据的最后一行去 ( 注意大小写) ;

q : 离开 less 这个程序;

3.数据撷取

1.head ( 取出前面几行)

[root@study ~]# head [-n number] 文件

选项与参数:

-n : 后面接数字, 代表显示几行的意思

2.tail ( 取出后面几行)

[root@study ~]# tail [-n number] 文件

选项与参数:

-n : 后面接数字, 代表显示几行的意思

-f : 表示持续侦测后面所接的文件名, 要等到按下[ctrl]-c才会结束tail的侦测

bogon:学习 yuyan$ head -n 1 hello.txt
hello from hogwarts
bogon:学习 yuyan$ tail -n 1 hello.txt
hello from testerhome

😁愿每天都进步一点点😁

相关文章

  • 软件测试基础知识-Linux篇(3)

    1.直接检视文件内容 1.cat [root@study ~]# cat [-AbEnTv]选项与参数:-b : ...

  • 软件测试文章收集

    1.软件测试理论概念 软件测试基础 软件测试基础知识大全(上篇) 软件测试基础知识大全(下篇) 软件测试基础学习 ...

  • 软件测试基础知识-Linux篇(1)

    1.linux -ls 查看文件方法 ls -查看当前目录下文件 ls -al 查看当前目录下文件属性 2.Liu...

  • 软件测试基础知识-Linux篇(2)

    Liunx 文件与目录管理 方法 1.cd: 变换目录 2.pwd: 显示目前的目录 pwd –P : 列出当前的...

  • 备考第一天

    软件测评师教程共3篇。分为20章。 第一篇 软件测试概论、软件测试基础、软件质量与评价(软件测试标准)、软件测试过...

  • 03 软件测试方法[上]

    软件测试基础知识03—软件测试方法[上] 静态测试和动态测试(是否执行被测软件角度划分) 静态测试(Static ...

  • 02软件测试计划

    软件测试基础知识02—软件测试计划 1.软件测试计划的制定 1.1需求分析 1).定义被测试对象和测试目标确定软件...

  • 初学者的软件测试入门基础知识

    软件测试基础概念篇,科普软件测试基础知识,适用于入门 /01/学习方法 关掉抖音,放下手机 专注力 制定小而可实现...

  • 软件测试 基础知识

    基础知识掌握 推荐大家阅读 《软件测试 第二版》 另欢迎大家纠错 此篇主要梳理如下几个方面:测试流程 、测试用例...

  • 03软件测试方法[下]

    软件测试基础知识03—软件测试方法[下] 单元测试、集成测试、确认测试、系统测试、验收测试(测试策略和测试过程的角...

网友评论

      本文标题:软件测试基础知识-Linux篇(3)

      本文链接:https://www.haomeiwen.com/subject/auvtkltx.html