今天我们来详细讲解下,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.
数据分析咨询请扫描二维码
在准备数据分析师面试时,掌握高频考题及其解答是应对面试的关键。为了帮助大家轻松上岸,以下是10个高频考题及其详细解析,外加 ...
2024-12-20互联网数据分析师是一个热门且综合性的职业,他们通过数据挖掘和分析,为企业的业务决策和运营优化提供强有力的支持。尤其在如今 ...
2024-12-20在现代商业环境中,数据分析师是不可或缺的角色。他们的工作不仅仅是对数据进行深入分析,更是协助企业从复杂的数据信息中提炼出 ...
2024-12-20随着大数据时代的到来,数据驱动的决策方式开始受到越来越多企业的青睐。近年来,数据分析在人力资源管理中正在扮演着至关重要的 ...
2024-12-20在数据分析的世界里,表面上的技术操作只是“入门票”,而真正的高手则需要打破一些“看不见的墙”。这些“隐形天花板”限制了数 ...
2024-12-19在数据分析领域,尽管行业前景广阔、岗位需求旺盛,但实际的工作难度却远超很多人的想象。很多新手初入数据分析岗位时,常常被各 ...
2024-12-19入门数据分析,许多人都会感到“难”,但这“难”究竟难在哪儿?对于新手而言,往往不是技术不行,而是思维方式、业务理解和实践 ...
2024-12-19在如今的行业动荡背景下,数据分析师的职业前景虽然面临一些挑战,但也充满了许多新的机会。随着技术的不断发展和多领域需求的提 ...
2024-12-19在信息爆炸的时代,数据分析师如同探险家,在浩瀚的数据海洋中寻觅有价值的宝藏。这不仅需要技术上的过硬实力,还需要一种艺术家 ...
2024-12-19在当今信息化社会,大数据已成为各行各业不可或缺的宝贵资源。大数据专业应运而生,旨在培养具备扎实理论基础和实践能力,能够应 ...
2024-12-19阿里P8、P9失业都找不到工作?是我们孤陋寡闻还是世界真的已经“癫”成这样了? 案例一:本硕都是 985,所学的专业也是当红专业 ...
2024-12-19CDA持证人Louis CDA持证人基本情况 我大学是在一个二线城市的一所普通二本院校读的,专业是旅游管理,非计算机非统计学。毕业之 ...
2024-12-18最近,知乎上有个很火的话题:“一个人为何会陷入社会底层”? 有人说,这个世界上只有一个分水岭,就是“羊水”;还有人说,一 ...
2024-12-18在这个数据驱动的时代,数据分析师的技能需求快速增长。掌握适当的编程语言不仅能增强分析能力,还能帮助分析师从海量数据中提取 ...
2024-12-17在当今信息爆炸的时代,数据分析已经成为许多行业中不可或缺的一部分。想要在这个领域脱颖而出,除了热情和毅力外,你还需要掌握 ...
2024-12-17数据分析,是一项通过科学方法处理数据以获取洞察并支持决策的艺术。无论是在商业环境中提升业绩,还是在科研领域推动创新,数据 ...
2024-12-17在数据分析领域,图表是我们表达数据故事的重要工具。它们不仅让数据变得更加直观,也帮助我们更好地理解数据中的趋势和模式。相 ...
2024-12-16在当今社会,我们身处着一个飞速发展、变化迅猛的时代。不同行业在科技进步、市场需求和政策支持的推动下蓬勃发展,呈现出令人瞩 ...
2024-12-16在现代商业世界中,数据分析师扮演着至关重要的角色。他们通过解析海量数据,为企业战略决策提供有力支持。要有效完成这项任务, ...
2024-12-16在当今数据爆炸的时代,数据分析师是组织中不可或缺的导航者。他们通过从大量数据中提取可操作的洞察力,帮助企业在竞争激烈的市 ...
2024-12-16