Linux Commands for Beginners--Head and Tail Command

In this part, I go over both the head and tail commands.

1.COMMAND:
     head
DESCRIPTION:
     Print  the  first  10 lines of  FILE to standard output.
SYNOPSIS:
       head [OPTION]... [FILE]...
OPTION:
     -n, --lines
              print  the first n lines instead of the first 10;


2.COMMAND:
    tail
DESCRIPTION:
    Print the last 10 lines of FILE to standard output.
SYNOPSIS:
    tail [OPTION]... [FILE]...
OPTION:
     -n, --lines      output the last K lines, instead of the last 10;


Examples:
root@piniheaven:~/tutorial# ls
poem.txt
root@piniheaven:~/tutorial# head poem.txt   # Print  the  first  10 lines of  poem.txt to standard output.
nt you to know
one thing.

You know how this is:
if I look
at the crystal moon, at the red branch
of the slow autumn at my window,
if I touch
near the fire
the impalpable ash
root@piniheaven:~/tutorial# head -4 poem.txt   # Print  the  first 4 lines of  poem.txt to standard output.
nt you to know
one thing.

You know how this is:
root@piniheaven:~/tutorial# tail poem.txt    # Print  the last  10 lines of  poem.txt to standard output.
you feel that you are destined for me
with implacable sweetness,
if each day a flower
climbs up to your lips to seek me,
ah my love, ah my own,
in me all that fire is repeated,
in me nothing is extinguished or forgotten,
my love feeds on your love, beloved,
and as long as you live it will be in your arms
without leaving mine
root@piniheaven:~/tutorial# tail -3 poem.txt    # Print  the last 3 lines of  poem.txt to standard output.
my love feeds on your love, beloved,
and as long as you live it will be in your arms
without leaving mine

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值