Archive

Posts Tagged ‘tac’

cat tac nl命令

August 2nd, 2012 No comments

[[email protected] unixftp]# cat /etc/issue
CentOS release 6.6 (Final)
Kernel \r on an \m

[[email protected] unixftp]# cat -n /etc/issue
1 CentOS release 6.6 (Final)
2 Kernel \r on an \m
3
[[email protected] unixftp]# tac /etc/issue

Kernel \r on an \m
CentOS release 6.6 (Final)

[[email protected] unixftp]# nl -b a /etc/issue
1 CentOS release 6.6 (Final)
2 Kernel \r on an \m
3
[[email protected] unixftp]# nl -b a -n rz /etc/issue
000001 CentOS release 6.6 (Final)
000002 Kernel \r on an \m
000003
[[email protected] unixftp]# nl -b a -n rz -w 3 /etc/issue
001 CentOS release 6.6 (Final)
002 Kernel \r on an \m
003

  • cat  由第一行开始显示文件内容
  • tac  从最后一行开始显示,可以看出 tac 是 cat 的倒著写!
  • nl   显示的时候,顺道输出行号!
Categories: linux基础 Tags: , , ,