京公网安备 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
在用户行为分析实践中,很多从业者会陷入一个核心误区:过度关注“当前数据的分析结果”,却忽视了结果的“泛化能力”——即分析 ...
2026-03-13在数字经济时代,用户的每一次点击、浏览、停留、转化,都在传递着真实的需求信号。用户行为分析,本质上是通过收集、整理、挖掘 ...
2026-03-13在金融、零售、互联网等数据密集型行业,量化策略已成为企业挖掘商业价值、提升决策效率、控制经营风险的核心工具。而CDA(Certi ...
2026-03-13在机器学习建模体系中,随机森林作为集成学习的经典算法,凭借高精度、抗过拟合、适配多场景、可解释性强的核心优势,成为分类、 ...
2026-03-12在机器学习建模过程中,“哪些特征对预测结果影响最大?”“如何筛选核心特征、剔除冗余信息?”是从业者最常面临的核心问题。随 ...
2026-03-12在数字化转型深度渗透的今天,企业管理已从“经验驱动”全面转向“数据驱动”,数据思维成为企业高质量发展的核心竞争力,而CDA ...
2026-03-12在数字经济飞速发展的今天,数据分析已从“辅助工具”升级为“核心竞争力”,渗透到商业、科技、民生、金融等各个领域。无论是全 ...
2026-03-11上市公司财务报表是反映企业经营状况、盈利能力、偿债能力的核心数据载体,是投资者决策、研究者分析、从业者复盘的重要依据。16 ...
2026-03-11数字化浪潮下,数据已成为企业生存发展的核心资产,而数据思维,正是CDA(Certified Data Analyst)数据分析师解锁数据价值、赋 ...
2026-03-11线性回归是数据分析中最常用的预测与关联分析方法,广泛应用于销售额预测、风险评估、趋势分析等场景(如前文销售额预测中的多元 ...
2026-03-10在SQL Server安装与配置的实操中,“服务名无效”是最令初学者头疼的高频问题之一。无论是在命令行执行net start启动服务、通过S ...
2026-03-10在数据驱动业务的当下,CDA(Certified Data Analyst)数据分析师的核心价值,不仅在于解读数据,更在于搭建一套科学、可落地的 ...
2026-03-10在企业经营决策中,销售额预测是核心环节之一——无论是库存备货、营销预算制定、产能规划,还是战略布局,都需要基于精准的销售 ...
2026-03-09金融数据分析的核心价值,是通过挖掘数据规律、识别风险、捕捉机会,为投资决策、风险控制、业务优化提供精准支撑——而这一切的 ...
2026-03-09在数据驱动决策的时代,CDA(Certified Data Analyst)数据分析师的核心工作,是通过数据解读业务、支撑决策,而指标与指标体系 ...
2026-03-09在数据处理的全流程中,数据呈现与数据分析是两个紧密关联却截然不同的核心环节。无论是科研数据整理、企业业务复盘,还是日常数 ...
2026-03-06在数据分析、数据预处理场景中,dat文件是一种常见的二进制或文本格式数据文件,广泛应用于科研数据、工程数据、传感器数据等领 ...
2026-03-06在数据驱动决策的时代,CDA(Certified Data Analyst)数据分析师的核心价值,早已超越单纯的数据清洗与统计分析,而是通过数据 ...
2026-03-06在教学管理、培训数据统计、课程体系搭建等场景中,经常需要对课时数据进行排序并实现累加计算——比如,按课程章节排序,累加各 ...
2026-03-05在数据分析场景中,环比是衡量数据短期波动的核心指标——它通过对比“当前周期与上一个相邻周期”的数据,直观反映指标的月度、 ...
2026-03-05