在 Linux 中使用 cat 命令

   cat 命令用于打印文本文件的文件内容。至少,大多数 Linux 用户都是这么做的,而且没有什么问题。

    cat 实际上代表 “连接(concatenate)”,创建它是为了 合并文本文件。但只要有一个参数,它就会打印文件内容。因此,它是用户在终端中读取文件而无需任何其他选项的首选。

在 Linux 中使用 cat 命令

要使用 cat 命令,你必须遵循给定的命令语法:

cat [options] Filename(s)

这里:

  • [options] 用于修改 cat 命令的默认行为,例如使用 -n 选项获取每行的数字。
  • Filename 是你输入要使用的文件的文件名的位置。

为了简单起见,我将在本指南中使用名为 Haruki.txt 的文本文件,其中包含以下文本行:

Hear the Wind Sing (1979)
Pinball, 1973 (1980)
A Wild Sheep Chase (1982)
Hard-Boiled Wonderland and the End of the World (1985)
Norwegian Wood (1987)
Dance Dance Dance (1990)
South of the Border, West of the Sun (1992)
The Wind-Up Bird Chronicle (1994)
Sputnik Sweetheart (1999)
Kafka on the Shore (2002)
After Dark (2004)
1Q84 (2009-2010)
Colorless Tsukuru Tazaki and His Years of Pilgrimage (2013)
Men Without Women (2014)
Killing Commendatore (2017)

那么,在没有任何选项的情况下使用时,输出会是什么? 好吧,让我们看一下:

cat Haruki.txt

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值