今天我们来详细讲解下,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.
数据分析咨询请扫描二维码
在当今以数据为导向的商业环境中,数据分析师的角色变得越来越重要。无论是揭示消费者行为的趋势,还是优化企业运营的效率,数据 ...
2024-11-17在当今以数据为导向的商业环境中,数据分析师的角色变得越来越重要。无论是揭示消费者行为的趋势,还是优化企业运营的效率,数据 ...
2024-11-17金融数学是一门充满挑战和机遇的专业,它将数学、统计学和金融学的知识有机结合,旨在培养能够运用数学和统计方法解决复杂金融市 ...
2024-11-16在信息时代的浪潮中,大数据已成为推动创新的重要力量。无论是在商业、医疗、金融,还是在日常生活中,大数据扮演的角色都愈发举 ...
2024-11-16随着大数据技术的迅猛发展,数据已经成为现代商业、科技乃至生活各个方面的重要资产。大数据专业的毕业生在这一变革背景下,拥有 ...
2024-11-15随着大数据技术的迅猛发展,数据已经成为现代商业、科技乃至生活各个方面的重要资产。大数据专业的毕业生在这一变革背景下,拥有 ...
2024-11-15在快速演变的数字时代,数据分析已成为多个行业的核心驱动力。无论你是刚刚踏入数据分析领域,还是寻求进一步发展的专业人士,理 ...
2024-11-15Python作为一种通用编程语言,以其简单易学、功能强大等特点,成为众多领域的核心技术驱动者。无论是初学者还是有经验的编程人员 ...
2024-11-15在当今数据驱动的世界中,数据分析已成为许多行业的基础。无论是商业决策,产品开发,还是市场策略优化,数据分析都扮演着至关重 ...
2024-11-15数据分析作为现代商业和研究领域不可或缺的一部分,吸引了越来越多的初学者。然而,自学数据分析的过程中,初学者常常会遇到许多 ...
2024-11-15在当今的数据驱动世界中,机器学习方法在数据挖掘与分析中扮演着核心角色。这些方法通过从数据中学习模式和规律来构建模型,实现 ...
2024-11-15随着数据在各个行业的重要性日益增加,数据分析师在商业和技术领域的角色变得至关重要。其核心职责之一便是通过数据可视化,将复 ...
2024-11-15数据分析师的职责不仅仅局限于解析数据和得出结论,更在于将这些复杂的信息转换为清晰、易懂且具有影响力的沟通。良好的沟通能力 ...
2024-11-15数字化转型是企业提升竞争力和实现可持续发展的关键路径。面对快速变化的市场环境,以及技术的飞速发展,企业在数字化转型过程中 ...
2024-11-15CDA数据分析师认证:CDA认证分为三个等级:Level Ⅰ、Level Ⅱ和Level Ⅲ,每个等级的报考条件如下: Le ...
2024-11-14自学数据分析可能是一条充满挑战却又令人兴奋的道路。随着数据在现代社会中的重要性日益增长,掌握数据分析技能不仅能提升你的就 ...
2024-11-14数据分析相关职业选择 数据分析领域正在蓬勃发展,为各种专业背景的人才提供了丰富的职业机会。从初学者到有经验的专家,每个人 ...
2024-11-14数据挖掘与分析在金融行业的使用 在当今快速发展的金融行业中,数据挖掘与分析的应用愈发重要,成为驱动行业变革和提升竞争力的 ...
2024-11-14学习数据挖掘需要掌握哪些技能 数据挖掘是一个不断发展的领域,它结合了统计学、计算机科学和领域专业知识,旨在从数据中提取有 ...
2024-11-14统计学作为一门基于数据的学科,其广泛的应用领域和多样的职业选择,使得毕业生拥有丰厚的就业前景。无论是在政府还是企业,统计 ...
2024-11-14