cat顯示行號
cat -n
使用cat看長文件,尤其是配置文件,沒有行號很不方便。
使用cat命令時,添加參數-n,可以在查看時顯示行號。
e.g.
查看日志的配置文件
[root@C8-3 ~]# cat -n /etc/rsyslog.conf
1 # rsyslog configuration file
2
3 # For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html
4 # or latest version online at http://www.rsyslog.com/doc/rsyslog_conf.html
5 # If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html
6
7 #### MODULES ####
8
9 module(load="imuxsock" # provides support for local system logging (e.g. via logger command)
10 SysSock.Use="off") # Turn off message reception via local log socket;
11 # local messages are retrieved through imjournal now.
12 module(load="imjournal" # provides access to the systemd journal
13 StateFile="imjournal.state") # File to store the position in the journal
14 #module(load="imklog") # reads kernel messages (the same are read from journald)
15 #module(load"immark") # provides --MARK-- message capability
16
17 # Provides UDP syslog reception
18 # for parameters see http://www.rsyslog.com/doc/imudp.html
19 #module(load="imudp") # needs to be done just once
20 #input(type="imudp" port="514")
21
22 # Provides TCP syslog reception
23 # for parameters see http://www.rsyslog.com/doc/imtcp.html
24 #module(load="imtcp") # needs to be done just once
25 #input(type="imtcp" port="514")
26
27 #### GLOBAL DIRECTIVES ####
28
29 # Where to place auxiliary files
30 global(workDirectory="/var/lib/rsyslog")
31
32 # Use default timestamp format
33 module(load="builtin:omfile" Template="RSYSLOG_TraditionalFileFormat")
34
35 # Include all config files in /etc/rsyslog.d/
36 include(file="/etc/rsyslog.d/*.conf" mode="optional")
37
38 #### RULES ####
39
40 # Log all kernel messages to the console.
41 # Logging much else clutters up the screen.
42 #kern.* /dev/console
43
44 # Log anything (except mail) of level info or higher.
45 # Don't log private authentication messages!
46 *.info;mail.none;authpriv.none;cron.none /var/log/messages
47
48 # The authpriv file has restricted access.
49 authpriv.* /var/log/secure
50
51 # Log all the mail messages in one place.
52 mail.* -/var/log/maillog
53
54
55 # Log cron stuff
56 cron.* /var/log/cron
57
58 # Everybody gets emergency messages
59 *.emerg :omusrmsg:*
60
61 # Save news errors of level crit and higher in a special file.
62 uucp,news.crit /var/log/spooler
63
64 # Save boot messages also to boot.log
65 local7.* /var/log/boot.log
66
67
68 # ### sample forwarding rule ###
69 #action(type="omfwd"
70 # An on-disk queue is created for this action. If the remote host is
71 # down, messages are spooled to disk and sent when it is up again.
72 #queue.filename="fwdRule1" # unique name prefix for spool files
73 #queue.maxdiskspace="1g" # 1gb space limit (use as much as possible)
74 #queue.saveonshutdown="on" # save messages to disk on shutdown
75 #queue.type="LinkedList" # run asynchronously
76 #action.resumeRetryCount="-1" # infinite retries if host is down
77 # Remote Logging (we use TCP for reliable delivery)
78 # remote_host is: name/ip, e.g. 192.168.0.1, port optional e.g. 10514
79 #Target="remote_host" Port="XXX" Protocol="tcp")