京公网安备 11010802034615号
经营许可证编号:京B2-20210330
今天我们来详细讲解下,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.
数据分析咨询请扫描二维码
若不方便扫码,搜微信号:CDAshujufenxi
日常用Excel做数据管理、台账维护、报表整理时,添加备注列是高频操作——用来标注异常、说明业务背景、记录处理进度、补充关键 ...
2026-03-23作为业内主流的自助式数据可视化工具,Tableau凭借拖拽式操作、强大的数据联动能力、灵活的仪表板搭建,成为数据分析师、业务人 ...
2026-03-23在CDA(Certified Data Analyst)数据分析师的日常工作与认证考核中,分类变量的关联分析是高频核心场景。用户性别是否影响商品 ...
2026-03-23在数据工作的全流程中,数据清洗是最基础、最耗时,同时也是最关键的核心环节,无论后续是做常规数据分析、可视化报表,还是开展 ...
2026-03-20在大数据与数据驱动决策的当下,“数据分析”与“数据挖掘”是高频出现的两个核心概念,也是很多职场人、入门学习者容易混淆的术 ...
2026-03-20在CDA(Certified Data Analyst)数据分析师的全流程工作闭环中,统计制图是连接严谨统计分析与高效业务沟通的关键纽带,更是CDA ...
2026-03-20在MySQL数据库优化中,分区表是处理海量数据的核心手段——通过将大表按分区键(如时间、地域、ID范围)分割为多个独立的小分区 ...
2026-03-19在商业智能与数据可视化领域,同比、环比增长率是分析数据变化趋势的核心指标——同比(YoY)聚焦“长期趋势”,通过当前周期与 ...
2026-03-19在数据分析与建模领域,流传着一句行业共识:“数据决定上限,特征决定下限”。对CDA(Certified Data Analyst)数据分析师而言 ...
2026-03-19机器学习算法工程的核心价值,在于将理论算法转化为可落地、可复用、高可靠的工程化解决方案,解决实际业务中的痛点问题。不同于 ...
2026-03-18在动态系统状态估计与目标跟踪领域,高精度、高鲁棒性的状态感知是机器人导航、自动驾驶、工业控制、目标检测等场景的核心需求。 ...
2026-03-18“垃圾数据进,垃圾结果出”,这是数据分析领域的黄金法则,更是CDA(Certified Data Analyst)数据分析师日常工作中时刻恪守的 ...
2026-03-18在机器学习建模中,决策树模型因其结构直观、易于理解、无需复杂数据预处理等优势,成为分类与回归任务的首选工具之一。而变量重 ...
2026-03-17在数据分析中,卡方检验是一类基于卡方分布的假设检验方法,核心用于分析分类变量之间的关联关系或实际观测分布与理论期望分布的 ...
2026-03-17在数字化转型的浪潮中,企业积累的数据日益庞大且分散——用户数据散落在注册系统、APP日志、客服记录中,订单数据分散在交易平 ...
2026-03-17在数字化时代,数据分析已成为企业决策、业务优化、增长突破的核心支撑,从数据仓库搭建(如维度表与事实表的设计)、数据采集清 ...
2026-03-16在数据仓库建设、数据分析(尤其是用户行为分析、业务指标分析)的实践中,维度表与事实表是两大核心组件,二者相互依存、缺一不 ...
2026-03-16数据是CDA(Certified Data Analyst)数据分析师开展一切工作的核心载体,而数据读取作为数据生命周期的关键环节,是连接原始数 ...
2026-03-16在用户行为分析实践中,很多从业者会陷入一个核心误区:过度关注“当前数据的分析结果”,却忽视了结果的“泛化能力”——即分析 ...
2026-03-13在数字经济时代,用户的每一次点击、浏览、停留、转化,都在传递着真实的需求信号。用户行为分析,本质上是通过收集、整理、挖掘 ...
2026-03-13