第一句子大全,网罗天下好句子,好文章尽在本站!

Linux浏览文件命令:cat less more详解!

时间:2017-03-07

今天我们来详细讲解下,Linux浏览文件的三种命令,它们分别是:cat、less、more!cat命令: 一次性在终端中显示文件的所有内容cat Facebook首席运营官桑

友情提示:本文共有 3481 个字,阅读大概需要 7 分钟。

今天我们来详细讲解下,Linux浏览文件的三种命令,它们分别是:cat、less、more!

cat命令: 一次性在终端中显示文件的所有内容

cat Facebook首席运营官桑德伯格《Lean In》.txt

cat命令显示出多少行呢?

参数:n 由 1 开始对所有输出的行数进行编号

cat -n Facebook首席运营官桑德伯格《Lean In》.txt

cat命令还可以连接多个文本的内容一起输出

cat -n hello.txt word.txt

less命令: 分页显示文件内容

less和cat最大的区别是:less命令会分一页一页地显示文件内容,cat会一次性全部显示

less Facebook首席运营官桑德伯格《Lean In》.txt

这时我们会看到 less命令不会一次性读取 ‘Facebook首席运营官桑德伯格《Lean In》.txt’ 文本里的全部内容,而是会分页读取,每一页读取内容的多少是由你的终端大小来决定的

less命令浏览文件的快捷键:

注意:这里快捷键的字母都是区分大小写的

less命令浏览文件高级快捷键的使用

“=”键:显示当前页面的内容是文件中第几行到第几行,按Enter键撤销

Facebook首席运营官桑德伯格《Lean In》.txt lines 5-10/287 byte 4308/171635 3% (press RETURN)

下面我们就对这段描述信息座椅详细的解释:

Facebook首席运营官桑德伯格《Lean In》.txt: 表示当前正在读取文件的名称

lines 5-10/287: 表示这个文本总共有287行,当前正在读取的是5-10行

byte 4308/171635: 表示文本总共有171635个字符,当前读取了4308个字符

%3: 表示当前读取的内容占了文本内容总共的 %3

h键:进入快捷键的帮助文档,按q键退出

/(斜杠):进入搜索模式

如:搜索关键字 more

要想在搜索中跳转到下一个符合的内容,可以按n键,按N键可以跳到上一个符合的内容

more命令

more命令和less命令相似,但没有less命令强大

如:more命令不能往后翻页,只能一路往前翻页

这是因为more命令是在less命令之前出现的

注:这是Facebook首席运营官桑德伯格《Lean In》的部分篇章,大家可以用这部分篇章来对cat、less命令做一次动手实操的练习,这样可以帮助大家更好的理解less命令的强大之处

I GOT PREGNANT with my first child in the summer of 2004. At the time, I was running the online sales and operations groups at Google. I had joined the company three and a half years earlier when it was an obscure start-up with a few hundred employees in a run-down office building. By my first trimester, Google had grown into a company of thousands and moved into a multibuilding campus.

My pregnancy was not easy. The typical morning sickness that often accompanies the first trimester affected me every day for nine long months. I gained almost seventy pounds, and my feet swelled two entire shoe sizes, turning into odd-shaped lumps I could see only when they were propped up on a coffee table. A particularly sensitive Google engineer announced that “Project Whale” was named after me.

One day, after a rough morning spent staring at the bottom of the toilet, I had to rush to make an important client meeting. Google was growing so quickly that parking was an ongoing problem, and the only spot I could find was quite far away. I sprinted across the parking lot, which in reality meant lumbering a bit more quickly than my absurdly slow pregnancy crawl. This only made my nausea worse, and I arrived at the meeting praying that a sales pitch was the only thing that would come out of my mouth. That night, I recounted these troubles to my husband, Dave. He pointed out that Yahoo, where he worked at the time, had designated parking for expectant mothers at the front of each building.

The next day, I marched in—or more like waddled in—to see Google founders Larry Page and Sergey Brin in their office, which was really just a large room with toys and gadgets strewn all over the floor. I found Sergey in a yoga position in the corner and announced that we needed pregnancy parking, preferably sooner rather than later. He looked up at me and agreed immediately, noting that he had never thought about it before.

To this day, I’m embarrassed that I didn’t realize that pregnant women needed reserved parking until I experienced my own aching feet. As one of Google’s most senior women, didn’t I have a special responsibility to think of this? But like Sergey, it had never occurred to me. The other pregnant women must have suffered in silence, not wanting to ask for special treatment. Or maybe they lacked the confidence or seniority to demand that the problem be fixed. Having one pregnant woman at the top—even one who looked like a whale—made the difference.

本文如果对你有帮助,请点赞收藏《Linux浏览文件命令:cat less more详解!》,同时在此感谢原作者。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。
相关阅读
linux之磁盘分区与文件系统

linux之磁盘分区与文件系统

...区分同种类型下的不同的设备:是特定设备的访问入口mknod命令:建立块专用或字符专用文件分区:/dev/sda注:Centos6/7将硬盘设备文件标识为/dev/sd[a-z]磁盘分区:MBR:主引导记录分为三部分:前446字节:用来引导启动操作系统的程...

2012-11-07 #经典句子

最快捷的Linux命令查询工具来了 一句话自动返回操作指南

最快捷的Linux命令查询工具来了 一句话自动返回操作指南

...道 | 公众号 QbitAI无论你是Linux萌新用户还是老司机,使用命令行总会遇到不懂的问题。遇到问题要么去论坛询问、谷歌搜索,要么查自带命令手册(RTFM),过程耗时,结果也不直观。一位印度软件工程师针对这一难题,开发了...

2023-09-17 #经典句子

Linux 的发展历史 设计哲学和一些常用的术语介绍

Linux 的发展历史 设计哲学和一些常用的术语介绍

...导加载程序、服务、文件系统、X Window 系统、桌面环境和命令行。这些在 Linux 社区中非常常用。内核被认为是 Linux 操作系统的大脑。它控制硬件并使硬件与应用程序交互。内核的一个例子是 Linux 内核。可以在 kernel.org 网站上找...

2013-04-20 #经典句子

linux之rsync远程同步文件

linux之rsync远程同步文件

...本地,远程备份文件,rsync最重要的一点是支持增量备份。命令语法rsync [OPTION]... SRC DESTrsync [OPTION]... SRC [USER@]host:DESTrsync [OPTION]... [USER@]HOST:SRC DESTrsync [OPTION]... [USER@]HOST::SRC DESTrsync [OPTION]... SRC [USER@]HOST::DESTrsync [OPTION]... rsync://[USER@]HO...

2007-03-09 #经典句子

从C语言代码分析Linux系统是如何创建进程的

从C语言代码分析Linux系统是如何创建进程的

...数标志指定父子进程需要共享的资源,在 Linux 中输入 man 命令可以查看 clone() 函数的C语言原型:以及相关的参数标志:在Linux中,fork() 函数最终调用了 do_fork() 函数,它的C语言代码如下,请看(do_fork() 函数的C语言代码比较长,...

2018-01-17 #经典句子

2020很有深意的句子 气质洒脱 悟透人生!

2020很有深意的句子 气质洒脱 悟透人生!

...就多赚,分就远离,你不拯救自己,谁也帮不了你。Eat less fat, trapped, early to bed, poor to earn more, points away from, you don"t save yourself, no one can"t help you.上帝很有意思,猫喜欢吃鱼,猫却不能下水,鱼喜欢吃蚯蚓,鱼却不能上岸,人生...

2023-10-17 #经典句子

58个常用英语短语 可以防止你的英语退化!

58个常用英语短语 可以防止你的英语退化!

...eds满足要求20. might as well不妨21. mistake a for b认错22. more or less或多或少,有点23. my treat我请客24. narrow escape九死一生25. necessary to /for必要的26. next door隔壁的,在隔壁27. next o下一个,其次28. no doubt无疑地29. no less than不少...不亚于30. no lo...

2013-08-12 #经典句子

基于linux平台的c语言语言教学针与数组

基于linux平台的c语言语言教学针与数组

大家好,我是陌尘,从今天开始,我会更新全套的c语言教学,从头开始,一步一步,跟着我学,你也可以成为程序大神c语言是七十年代初问世的,现在已经成为luax下的最流行的高级语言,luax大部分语言都是用c语言写的c语言非...

2023-02-01 #经典句子