检索命令上级实操lv3

1. grep 命令练习

  1. /var/log/messages 中查找所有包含 error 的行(忽略大小写)。

    root@localhost log]# grep -n -i error messages
    1099:May  8 00:53:15 localhost kernel: BERT: Boot Error Record Table support is disabled. Enable it by using bert_enable as kernel parameter.
    1569:May  8 00:53:43 localhost mcelog: Family 6 Model 183 CPU: only decoding architectural errors
    1640:May  8 00:53:46 localhost mcelog: Family 6 Model 183 CPU: only decoding architectural errors
    1768:May  8 00:54:12 localhost libvirtd: 2025-05-07 16:54:12.610+0000: 1443: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    1769:May  8 00:54:16 localhost libvirtd: 2025-05-07 16:54:16.943+0000: 1443: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    1770:May  8 00:54:16 localhost libvirtd: 2025-05-07 16:54:16.982+0000: 1443: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    2052:May  8 00:57:33 localhost journal: Error looking up permission: GDBus.Error:org.freedesktop.portal.Error.NotFound: No entry for geolocation
    2053:May  8 00:57:33 localhost journal: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name :1.167 was not provided by any .service files
    2153:May  8 00:58:14 localhost journal: Error looking up permission: GDBus.Error:org.freedesktop.portal.Error.NotFound: No entry for geolocation
    2159:May  8 00:58:20 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        file:///media/cdrom/” which is not a key-value pair, group, or comment
    2257:May  8 02:26:52 localhost journal: Error releasing name org.gnome.evolution.dataserver.AddressBook9: 连接已关闭
    2258:May  8 02:26:52 localhost journal: Error releasing name org.gnome.evolution.dataserver.Calendar7: 连接已关闭
    3370:May  8 17:51:47 localhost kernel: BERT: Boot Error Record Table support is disabled. Enable it by using bert_enable as kernel parameter.
    3871:May  8 17:52:14 localhost mcelog: Family 6 Model 183 CPU: only decoding architectural errors
    3910:May  8 17:52:17 localhost mcelog: Family 6 Model 183 CPU: only decoding architectural errors
    4021:May  8 17:52:35 localhost libvirtd: 2025-05-08 09:52:35.175+0000: 1376: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    4022:May  8 17:52:35 localhost libvirtd: 2025-05-08 09:52:35.329+0000: 1376: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    4023:May  8 17:52:35 localhost libvirtd: 2025-05-08 09:52:35.387+0000: 1376: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    4169:May  8 17:53:09 localhost journal: Error looking up permission: GDBus.Error:org.freedesktop.portal.Error.NotFound: No entry for geolocation
    4278:May  8 17:55:39 localhost journal: Error looking up permission: GDBus.Error:org.freedesktop.portal.Error.NotFound: No entry for geolocation
    5465:May  8 10:21:59 localhost kernel: BERT: Boot Error Record Table support is disabled. Enable it by using bert_enable as kernel parameter.
    5936:May  8 10:22:22 localhost mcelog: Family 6 Model 183 CPU: only decoding architectural errors
    6001:May  8 10:22:26 localhost mcelog: Family 6 Model 183 CPU: only decoding architectural errors
    6087:May  8 10:23:04 localhost libvirtd: 2025-05-08 02:23:04.717+0000: 1463: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    6088:May  8 10:23:04 localhost libvirtd: 2025-05-08 02:23:04.852+0000: 1463: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    6089:May  8 10:23:04 localhost libvirtd: 2025-05-08 02:23:04.913+0000: 1463: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    6193:May  8 10:23:35 localhost journal: Error looking up permission: GDBus.Error:org.freedesktop.portal.Error.NotFound: No entry for geolocation
    6195:May  8 10:23:35 localhost journal: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name :1.39 was not provided by any .service files
    6302:May  8 10:26:19 localhost journal: Error looking up permission: GDBus.Error:org.freedesktop.portal.Error.NotFound: No entry for geolocation
    6323:May  8 10:26:34 localhost journal: Failed to query location: Error resolving “location.services.mozilla.com”: 未知的名称或服务
    7656:May 12 08:19:35 localhost kernel: BERT: Boot Error Record Table support is disabled. Enable it by using bert_enable as kernel parameter.
    8164:May 12 08:20:05 localhost mcelog: Family 6 Model 183 CPU: only decoding architectural errors
    8194:May 12 08:20:07 localhost mcelog: Family 6 Model 183 CPU: only decoding architectural errors
    8287:May 12 08:20:39 localhost libvirtd: 2025-05-12 00:20:39.624+0000: 1455: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    8288:May 12 08:20:39 localhost libvirtd: 2025-05-12 00:20:39.727+0000: 1455: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    8289:May 12 08:20:39 localhost libvirtd: 2025-05-12 00:20:39.772+0000: 1455: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    8762:May 12 08:20:53 localhost journal: Error looking up permission: GDBus.Error:org.freedesktop.portal.Error.NotFound: No entry for geolocation
    8870:May 12 08:24:22 localhost journal: Error looking up permission: GDBus.Error:org.freedesktop.portal.Error.NotFound: No entry for geolocation
    8916:May 12 08:35:13 localhost journal: shell-extensions did not set error for gs_plugin_refresh
    8927:May 12 08:35:17 localhost journal: shell-extensions did not set error for gs_plugin_refresh
    8929:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8931:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8933:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8935:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8937:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8939:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8941:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8943:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8945:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8947:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8949:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8951:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8953:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8955:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8957:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8959:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8961:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8963:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8965:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8967:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8969:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8971:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8973:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8975:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8977:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8979:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8981:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8983:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8985:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8987:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8989:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8991:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8993:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8995:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8997:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    8999:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9001:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9003:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9005:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9007:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9009:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9011:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9013:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9015:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9017:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9019:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9021:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9023:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9025:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9027:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9029:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9031:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9033:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9035:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9037:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9039:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9041:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9043:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9045:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9047:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9049:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9051:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9053:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9055:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9057:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9059:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9061:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9063:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9065:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9067:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9069:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9071:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9073:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9075:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9077:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9079:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9081:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9083:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9085:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9087:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9089:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9091:May 12 08:35:42 localhost journal: not GsPlugin error from plugin repos g-key-file-error-quark:1: Key file contains line “        http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/” which is not a key-value pair, group, or comment
    9536:May 13 08:29:56 localhost journal: Failed to query location: Error resolving “location.services.mozilla.com”: 未知的名称或服务
    9621:May 13 09:10:21 localhost journal: Error releasing name org.gnome.evolution.dataserver.AddressBook9: 连接已关闭
    10753:May 13 09:11:58 localhost kernel: BERT: Boot Error Record Table support is disabled. Enable it by using bert_enable as kernel parameter.
    11216:May 13 09:12:15 localhost mcelog: Family 6 Model 183 CPU: only decoding architectural errors
    11274:May 13 09:12:19 localhost mcelog: Family 6 Model 183 CPU: only decoding architectural errors
    11375:May 13 09:12:37 localhost libvirtd: 2025-05-13 01:12:37.511+0000: 1415: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    11376:May 13 09:12:37 localhost libvirtd: 2025-05-13 01:12:37.658+0000: 1415: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    11377:May 13 09:12:37 localhost libvirtd: 2025-05-13 01:12:37.690+0000: 1415: error : virHostCPUGetTscInfo:1389 : 无法打开 tty /dev/kvm: 没有那个文件或目录
    11483:May 13 09:13:06 localhost journal: Error looking up permission: GDBus.Error:org.freedesktop.portal.Error.NotFound: No entry for geolocation
    11484:May 13 09:13:06 localhost journal: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name :1.39 was not provided by any .service files

  2. 统计 /var/log/secureFailed password 出现的次数。

    [root@localhost log]# grep "Failed" -c -i  secure
    3
    [root@localhost log]# grep "password" -c -i  secure
    57
  3. 列出 /etc 目录下所有包含 root 的配置文件名称。

    [root@localhost etc]# grep -r "root"
    fstab:/dev/mapper/centos-root /                       xfs     defaults        0 0
    grub.d/00_header:datarootdir="/usr/share"
    grub.d/00_header:export TEXTDOMAINDIR="${datarootdir}/locale"
    grub.d/00_header:if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT}"` ; then
    grub.d/00_header:    font="`make_system_path_relative_to_its_root "${font_path}"`"
    grub.d/00_header:loadfont (\$root)`make_system_path_relative_to_its_root $x`
    grub.d/00_header:set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
    grub.d/00_header:background_image -m stretch `make_system_path_relative_to_its_root "$GRUB_BACKGROUND"`
    grub.d/01_users:    set superusers="root"
    grub.d/01_users:    password_pbkdf2 root \${GRUB2_PASSWORD}
    grub.d/10_linux:datarootdir="/usr/share"
    grub.d/10_linux:export TEXTDOMAINDIR="${datarootdir}/locale"
    grub.d/10_linux:# loop-AES arranges things so that /dev/loop/X can be our root device, but
    grub.d/10_linux:        rootsubvol="`make_system_path_relative_to_its_root /`"
    grub.d/10_linux:        rootsubvol="${rootsubvol#/}"
    grub.d/10_linux:        if [ "x${rootsubvol}" != x ]; then
    grub.d/10_linux:            GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
    grub.d/10_linux:        bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
    grub.d/10_linux:    if [ -z "${prepare_root_cache}" ]; then
    grub.d/10_linux:      prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | grub_add_tab)"
    grub.d/10_linux:    printf '%s\n' "${prepare_root_cache}" | sed "s/^/$submenu_indentation/"
    grub.d/10_linux:        ${linuxefi} ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
    grub.d/10_linux:        linux${sixteenbit} ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
    grub.d/10_linux:prepare_root_cache=
    grub.d/10_linux:  rel_dirname=`make_system_path_relative_to_its_root $dirname`
    grub.d/10_linux:  linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
    grub.d/10_linux:    linux_root_device_thisversion=${GRUB_DEVICE}
    grub.d/20_linux_xen:datarootdir="/usr/share"
    grub.d/20_linux_xen:export TEXTDOMAINDIR="${datarootdir}/locale"
    grub.d/20_linux_xen:# loop-AES arranges things so that /dev/loop/X can be our root device, but
    grub.d/20_linux_xen:    rootsubvol="`make_system_path_relative_to_its_root /`"
    grub.d/20_linux_xen:    rootsubvol="${rootsubvol#/}"
    grub.d/20_linux_xen:    if [ "x${rootsubvol}" != x ]; then
    grub.d/20_linux_xen:        GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
    grub.d/20_linux_xen:    bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
    grub.d/20_linux_xen:    module  ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
    grub.d/20_linux_xen:    rel_xen_dirname=`make_system_path_relative_to_its_root $xen_dirname`
    grub.d/20_linux_xen:    rel_dirname=`make_system_path_relative_to_its_root $dirname`
    grub.d/20_linux_xen:    linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
    grub.d/20_linux_xen:        linux_root_device_thisversion=${GRUB_DEVICE}
    grub.d/30_os-prober:datarootdir="/usr/share"
    grub.d/30_os-prober:export TEXTDOMAINDIR="${datarootdir}/locale"
    grub.d/30_os-prober:    parttool \${root} hidden-
    grub.d/30_os-prober:    drivemap -s (hd0) \${root}
    grub.d/30_os-prober:    multiboot /boot/gnumach.gz root=device:${mach_device}
    grub.d/30_os-prober:                    --exec-server-task='\${exec-task}' -T typed '\${root}' \\
    pki/ca-trust/ca-legacy.conf:# The upstream Mozilla.org project tests all changes to the root CA
    pki/ca-trust/ca-legacy.conf:# to temporarily keep certain (legacy) root CA certificates trusted,
    pki/ca-trust/ca-legacy.conf:#   It may keep root CA certificate as trusted, which the upstream 
    pki/ca-trust/extracted/README:root CA certificates.
    pki/ca-trust/extracted/java/README:root CA certificates.
    匹配到二进制文件 pki/ca-trust/extracted/java/cacerts
    pki/ca-trust/extracted/openssl/README:root CA certificates.
    pki/ca-trust/extracted/openssl/ca-bundle.trust.crt:# Comodo AAA Services root
    pki/ca-trust/extracted/pem/README:root CA certificates.
    pki/ca-trust/extracted/pem/tls-ca-bundle.pem:# Comodo AAA Services root
    pki/ca-trust/extracted/pem/email-ca-bundle.pem:# Comodo AAA Services root
    pki/tls/certs/make-dummy-cert:  echo root@localhost.localdomain
    pki/tls/openssl.cnf:dir         = ./demoCA              # TSA root directory
    rpm/macros.perl-srpm:# from git source repository. This file must present in minimal build root to
    rpm/macros.perl-srpm:# This file must not use Perl or any non-minimal-build-root package. The
    rpm/macros.perl:%define perl_br_testdir %{buildroot}%{perl_testdir}/%{cpan_dist_name} \
    rpm/macros.perl:%defattr(-,root,root,-)\
    rpm/macros.fjava:install -dm 755 %{buildroot}%{_mavendepmapfragdir} \
    rpm/macros.fjava:    if [ -f %{buildroot}$_dir/$_jarpart ]; then \
    rpm/macros.fjava:       _jpath="%{buildroot}$_dir/$_jarpart" \
    rpm/macros.fjava:          %{buildroot}%{_mavendepmapfragdir}/%{?scl:%{pkg_name}}%{!?scl:%{name}}%{-f*:-%{-f*}} \\\
    rpm/macros.fjava:          %{buildroot}%{_mavenpomdir}/$_pompart \\\
    rpm/macros.fjava:sed -i 's:%{buildroot}::' ${_filelist} \
    rpm/macros.jpackage:%add_jvm_extension JAVA_LIBDIR=%{buildroot}%{_javadir} %{_bindir}/jvmjar -l
    rpm/macros.jpackage:install -d -m 755 %{buildroot}%{_bindir} \
    rpm/macros.jpackage:cat > %{buildroot}%{_bindir}/%5 << EOF \
    rpm/macros.jpackage:chmod 755 %{buildroot}%{_bindir}/%5\
    yum/pluginconf.d/fastestmirror.conf:# as root).
    匹配到二进制文件 udev/hwdb.bin
    ppp/eaptls-client:#client       server  /root/cert/client.crt   -       /root/cert/ca.crt       /root/cert/client.key
    ppp/eaptls-server:#client       server  -       /root/cert/server.crt   /root/cert/ca.crt       /root/cert/server.key       192.168.1.0/24
    lsm/pluginconf.d/sim.conf:require-root-privilege = false;
    lsm/lsmd.conf:allow-plugin-root-privilege = true;
    security/access.conf:# Disallow non-root logins on tty1
    security/access.conf:#-:ALL EXCEPT root:tty1
    security/access.conf:# User "root" should be allowed to get access via cron .. tty5 tty6.
    security/access.conf:#+:root:cron crond :0 tty1 tty2 tty3 tty4 tty5 tty6
    security/access.conf:# User "root" should be allowed to get access from hosts with ip addresses.
    security/access.conf:#+:root:192.168.200.1 192.168.200.4 192.168.200.9
    security/access.conf:#+:root:127.0.0.1
    security/access.conf:# User "root" should get access from network 192.168.201.
    security/access.conf:#+:root:192.168.201.
    security/access.conf:# User "root" should be able to have access from domain.
    security/access.conf:#+:root:.foo.bar.org
    security/access.conf:# User "root" should be denied to get access from all other sources.
    security/access.conf:#-:root:ALL
    security/chroot.conf:# /etc/security/chroot.conf
    security/chroot.conf:# username_regex   chroot_dir
    security/console.apps/config-util:USER=root
    security/console.apps/liveinst:USER=root
    security/console.apps/setup:USER=root

  4. /etc/passwd 中提取所有以 /sbin/nologin 结尾的行。

    [root@localhost etc]# cat passwd | grep -n "/sbin/nologin$"
    2:bin:x:1:1:bin:/bin:/sbin/nologin
    3:daemon:x:2:2:daemon:/sbin:/sbin/nologin
    4:adm:x:3:4:adm:/var/adm:/sbin/nologin
    5:lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
    9:mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
    10:operator:x:11:0:operator:/root:/sbin/nologin
    11:games:x:12:100:games:/usr/games:/sbin/nologin
    12:ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
    13:nobody:x:99:99:Nobody:/:/sbin/nologin
    14:systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin
    15:dbus:x:81:81:System message bus:/:/sbin/nologin
    16:polkitd:x:999:998:User for polkitd:/:/sbin/nologin
    17:libstoragemgmt:x:998:996:daemon account for libstoragemgmt:/var/run/lsm:/sbin/nologin
    18:colord:x:997:995:User for colord:/var/lib/colord:/sbin/nologin
    19:rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
    20:saned:x:996:994:SANE scanner daemon user:/usr/share/sane:/sbin/nologin
    21:saslauth:x:995:76:Saslauthd user:/run/saslauthd:/sbin/nologin
    22:abrt:x:173:173::/etc/abrt:/sbin/nologin
    23:setroubleshoot:x:994:991::/var/lib/setroubleshoot:/sbin/nologin
    24:rtkit:x:172:172:RealtimeKit:/proc:/sbin/nologin
    25:pulse:x:171:171:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
    26:radvd:x:75:75:radvd user:/:/sbin/nologin
    27:chrony:x:993:988::/var/lib/chrony:/sbin/nologin
    28:unbound:x:992:987:Unbound DNS resolver:/etc/unbound:/sbin/nologin
    29:qemu:x:107:107:qemu user:/:/sbin/nologin
    30:tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
    31:usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin
    32:geoclue:x:991:985:User for geoclue:/var/lib/geoclue:/sbin/nologin
    33:gluster:x:990:984:GlusterFS daemons:/run/gluster:/sbin/nologin
    34:gdm:x:42:42::/var/lib/gdm:/sbin/nologin
    35:rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
    36:nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
    37:gnome-initial-setup:x:989:983::/run/gnome-initial-setup/:/sbin/nologin
    38:sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
    39:avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
    40:postfix:x:89:89::/var/spool/postfix:/sbin/nologin
    41:ntp:x:38:38::/etc/ntp:/sbin/nologin
    42:tcpdump:x:72:72::/:/sbin/nologin
    ​

  5. 查找 /etc/ssh/sshd_config 中所有非注释行(排除以 # 开头的行)。

    [root@localhost /]# grep -v '^#' /etc/ssh/sshd_config | grep -v '^$'  
    HostKey /etc/ssh/ssh_host_rsa_key
    HostKey /etc/ssh/ssh_host_ecdsa_key
    HostKey /etc/ssh/ssh_host_ed25519_key
    SyslogFacility AUTHPRIV
    AuthorizedKeysFile      .ssh/authorized_keys
    PasswordAuthentication yes
    ChallengeResponseAuthentication no
    GSSAPIAuthentication yes
    GSSAPICleanupCredentials no
    UsePAM yes
    X11Forwarding yes
    AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
    AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
    AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
    AcceptEnv XMODIFIERS
    Subsystem       sftp    /usr/libexec/openssh/sftp-server
    ​

  6. /var/log/boot.log 中显示匹配 fail 的行及其后 3 行内容。

  7. 递归搜索 /etc/yum.repos.d/ 目录下所有包含 baseurl 的文件。

    [root@localhost /]# grep -lr "baseurl" /etc/yum.repos.d/
    /etc/yum.repos.d/CentOS-Base.repo

  8. 查找 /etc/fstab 中所有空行并显示行号。

    [root@localhost /]# grep -n "^$" /etc/fstab
    1:


2. find 命令练习

  1. 查找 /var/log/ 下所有大于 10MB 的日志文件。

    root@localhost /]# find /var/log/ -size +10M
    [root@localhost /]# find /var/log/ -size +5M
    /var/log/audit/audit.log.2
    /var/log/audit/audit.log.1
    /var/log/audit/audit.log

  2. 列出 /etc/ 下所有属主为 root.conf 文件。

    [root@localhost /]# find /etc/ -user root | find /etc/ -name "*.conf"
    /etc/resolv.conf
    /etc/fonts/conf.d/65-0-khmeros-base.conf
    /etc/fonts/conf.d/61-urw-fallback-backwards.conf
    /etc/fonts/conf.d/66-ucs-miscfixed.conf
    /etc/fonts/conf.d/31-cantarell.conf
    /etc/fonts/conf.d/60-overpass.conf
    /etc/fonts/conf.d/59-liberation-sans.conf
    /etc/fonts/conf.d/65-0-lohit-devanagari.conf
    /etc/fonts/conf.d/20-unhint-small-dejavu-sans.conf
    /etc/fonts/conf.d/65-sil-padauk.conf
    /etc/fonts/conf.d/57-dejavu-sans.conf
    /etc/fonts/conf.d/65-0-lohit-kannada.conf
    /etc/fonts/conf.d/59-liberation-mono.conf
    /etc/fonts/conf.d/65-0-nhn-nanum-gothic.conf
    /etc/fonts/conf.d/10-hinting-slight.conf
    /etc/fonts/conf.d/66-sil-abyssinica.conf
    /etc/fonts/conf.d/10-scale-bitmap-fonts.conf
    /etc/fonts/conf.d/66-sil-nuosu.conf
    /etc/fonts/conf.d/20-unhint-small-vera.conf
    /etc/fonts/conf.d/65-0-ttf-arphic-uming.conf
    /etc/fonts/conf.d/25-no-bitmap-fedora.conf
    /etc/fonts/conf.d/90-ttf-arphic-uming-embolden.conf
    /etc/fonts/conf.d/25-unhint-nonlatin.conf
    /etc/fonts/conf.d/65-0-lohit-tamil.conf
    /etc/fonts/conf.d/30-metric-aliases.conf
    /etc/fonts/conf.d/69-gnu-free-sans.conf
    /etc/fonts/conf.d/30-urw-aliases.conf
    /etc/fonts/conf.d/69-gnu-free-serif.conf
    /etc/fonts/conf.d/40-nonlatin.conf
    /etc/fonts/conf.d/45-generic.conf
    /etc/fonts/conf.d/45-latin.conf
    /etc/fonts/conf.d/49-sansserif.conf
    /etc/fonts/conf.d/50-user.conf
    /etc/fonts/conf.d/51-local.conf
    /etc/fonts/conf.d/60-generic.conf
    /etc/fonts/conf.d/60-latin.conf
    /etc/fonts/conf.d/65-0-smc-meera.conf
    /etc/fonts/conf.d/65-fonts-persian.conf
    /etc/fonts/conf.d/65-nonlatin.conf
    /etc/fonts/conf.d/69-unifont.conf
    /etc/fonts/conf.d/80-delicious.conf
    /etc/fonts/conf.d/90-synthetic.conf
    /etc/fonts/conf.d/61-urw-gothic.conf
    /etc/fonts/conf.d/61-urw-c059.conf
    /etc/fonts/conf.d/65-1-vlgothic-gothic.conf
    /etc/fonts/conf.d/61-urw-d050000l.conf
    /etc/fonts/conf.d/65-wqy-microhei.conf
    /etc/fonts/conf.d/61-urw-nimbus-sans.conf
    /etc/fonts/conf.d/65-0-lohit-telugu.conf
    /etc/fonts/conf.d/61-urw-nimbus-mono-ps.conf
    /etc/fonts/conf.d/61-urw-z003.conf
    /etc/fonts/conf.d/61-urw-bookman.conf
    /etc/fonts/conf.d/65-0-madan.conf
    /etc/fonts/conf.d/61-urw-standard-symbols-ps.conf
    /etc/fonts/conf.d/65-0-lohit-marathi.conf
    /etc/fonts/conf.d/61-urw-nimbus-roman.conf
    /etc/fonts/conf.d/61-urw-p052.conf
    /etc/fonts/conf.d/67-lohit-malayalam.conf
    /etc/fonts/conf.d/65-0-lohit-gujarati.conf
    /etc/fonts/conf.d/65-0-jomolhari.conf
    /etc/fonts/conf.d/65-0-wqy-zenhei-sharp.conf
    /etc/fonts/conf.d/20-unhint-small-dejavu-serif.conf
    /etc/fonts/conf.d/65-0-lohit-oriya.conf
    /etc/fonts/conf.d/57-dejavu-serif.conf
    /etc/fonts/conf.d/57-paratype-pt-sans.conf
    /etc/fonts/conf.d/30-0-google-crosextra-caladea-fontconfig.conf
    /etc/fonts/conf.d/20-unhint-small-dejavu-sans-mono.conf
    /etc/fonts/conf.d/59-liberation-serif.conf
    /etc/fonts/conf.d/57-dejavu-sans-mono.conf
    /etc/fonts/conf.d/65-0-lohit-punjabi.conf
    /etc/fonts/conf.d/65-0-lohit-bengali.conf
    /etc/fonts/conf.d/65-0-paktype-naskh-basic.conf
    /etc/fonts/conf.d/61-stix.conf
    /etc/fonts/conf.d/60-open-sans.conf
    /etc/fonts/conf.d/65-0-lohit-assamese.conf
    /etc/fonts/conf.d/65-lklug.conf
    /etc/fonts/conf.d/69-gnu-free-mono.conf
    /etc/fonts/conf.d/65-0-lohit-nepali.conf
    /etc/fonts/conf.d/62-google-crosextra-caladea-fontconfig.conf
    /etc/fonts/conf.d/30-0-google-crosextra-carlito-fontconfig.conf
    /etc/fonts/conf.d/62-google-crosextra-carlito-fontconfig.conf
    /etc/fonts/fonts.conf
    /etc/pki/ca-trust/ca-legacy.conf
    /etc/yum/pluginconf.d/fastestmirror.conf
    /etc/yum/pluginconf.d/langpacks.conf
    /etc/yum/protected.d/systemd.conf
    /etc/yum/version-groups.conf
    /etc/udev/udev.conf
    /etc/asound.conf
    /etc/lsm/pluginconf.d/sim.conf
    /etc/lsm/lsmd.conf
    /etc/fuse.conf
    /etc/security/pwquality.conf
    /etc/security/access.conf
    /etc/security/chroot.conf
    /etc/security/group.conf
    /etc/security/limits.conf
    /etc/security/limits.d/20-nproc.conf
    /etc/security/namespace.conf
    /etc/security/pam_env.conf
    /etc/security/sepermit.conf
    /etc/security/time.conf
    /etc/e2fsck.conf
    /etc/mke2fs.conf
    /etc/rdma/mlx4.conf
    /etc/rdma/modules/infiniband.conf
    /etc/rdma/modules/iwarp.conf
    /etc/rdma/modules/iwpmd.conf
    /etc/rdma/modules/opa.conf
    /etc/rdma/modules/rdma.conf
    /etc/rdma/modules/roce.conf
    /etc/rdma/modules/srp_daemon.conf
    /etc/rdma/rdma.conf
    /etc/sos.conf
    /etc/java/java.conf
    /etc/host.conf
    /etc/idmapd.conf
    /etc/openldap/ldap.conf
    /etc/libuser.conf
    /etc/GeoIP.conf
    /etc/logrotate.conf
    /etc/selinux/semanage.conf
    /etc/selinux/targeted/setrans.conf
    /etc/X11/xinit/xinput.d/none.conf
    /etc/X11/xinit/xinput.d/xcompose.conf
    /etc/X11/xinit/xinput.d/xim.conf
    /etc/X11/xinit/xinput.d/ibus.conf
    /etc/X11/xorg.conf.d/00-keyboard.conf
    /etc/xdg/user-dirs.conf
    /etc/libreport/events/report_CentOSBugTracker.conf
    /etc/libreport/events/report_Uploader.conf
    /etc/libreport/events/report_Bugzilla.conf
    /etc/libreport/events.d/centos_report_event.conf
    /etc/libreport/events.d/rhtsupport_event.conf
    /etc/libreport/events.d/uploader_event.conf
    /etc/libreport/events.d/bugzilla_event.conf
    /etc/libreport/events.d/mdadm_event.conf
    /etc/libreport/events.d/bugzilla_anaconda_event.conf
    /etc/libreport/events.d/abrt_event.conf
    /etc/libreport/events.d/smart_event.conf
    /etc/libreport/events.d/koops_event.conf
    /etc/libreport/events.d/vmcore_event.conf
    /etc/libreport/events.d/xorg_event.conf
    /etc/libreport/events.d/python_event.conf
    /etc/libreport/events.d/ccpp_retrace_event.conf
    /etc/libreport/events.d/ccpp_event.conf
    /etc/libreport/events.d/gconf_event.conf
    /etc/libreport/events.d/vimrc_event.conf
    /etc/libreport/events.d/emergencyanalysis_event.conf
    /etc/libreport/events.d/mailx_event.conf
    /etc/libreport/plugins/mantisbt.conf
    /etc/libreport/plugins/mantisbt_format.conf
    /etc/libreport/plugins/mantisbt_format_analyzer_libreport.conf
    /etc/libreport/plugins/mantisbt_formatdup.conf
    /etc/libreport/plugins/mantisbt_formatdup_analyzer_libreport.conf
    /etc/libreport/plugins/rhtsupport.conf
    /etc/libreport/plugins/upload.conf
    /etc/libreport/plugins/bugzilla.conf
    /etc/libreport/plugins/bugzilla_format.conf
    /etc/libreport/plugins/bugzilla_format_kernel.conf
    /etc/libreport/plugins/bugzilla_format_libreport.conf
    /etc/libreport/plugins/bugzilla_formatdup.conf
    /etc/libreport/plugins/bugzilla_format_anaconda.conf
    /etc/libreport/plugins/bugzilla_formatdup_anaconda.conf
    /etc/libreport/plugins/ureport.conf
    /etc/libreport/plugins/mailx.conf
    /etc/libreport/forbidden_words.conf
    /etc/libreport/ignored_words.conf
    /etc/libreport/report_event.conf
    /etc/libreport/workflows.d/report_centos.conf
    /etc/libreport/workflows.d/report_uploader.conf
    /etc/libreport/workflows.d/anaconda_event.conf
    /etc/libreport/workflows.d/report_mailx.conf
    /etc/prelink.conf.d/nss-softokn-prelink.conf
    /etc/prelink.conf.d/fipscheck.conf
    /etc/prelink.conf.d/grub2.conf
    /etc/prelink.conf.d/libreswan-fips.conf
    /etc/ld.so.conf
    /etc/ld.so.conf.d/libiscsi-x86_64.conf
    /etc/ld.so.conf.d/bind-export-x86_64.conf
    /etc/ld.so.conf.d/mariadb-x86_64.conf
    /etc/ld.so.conf.d/dyninst-x86_64.conf
    /etc/ld.so.conf.d/kernel-3.10.0-1160.el7.x86_64.conf
    /etc/nsswitch.conf
    /etc/sysctl.d/99-sysctl.conf
    /etc/systemd/bootchart.conf
    /etc/systemd/coredump.conf
    /etc/systemd/journald.conf
    /etc/systemd/logind.conf
    /etc/systemd/system.conf
    /etc/systemd/user.conf
    /etc/krb5.conf
    /etc/lvm/lvm.conf
    /etc/lvm/lvmlocal.conf
    /etc/libaudit.conf
    /etc/man_db.conf
    /etc/yum.conf
    /etc/depmod.d/dist.conf
    /etc/depmod.d/kvdo.conf
    /etc/dracut.conf
    /etc/dracut.conf.d/nvdimm-security.conf
    /etc/modprobe.d/dccp-blacklist.conf
    /etc/modprobe.d/mlx4.conf
    /etc/modprobe.d/truescale.conf
    /etc/modprobe.d/nvdimm-security.conf
    /etc/modprobe.d/firewalld-sysctls.conf
    /etc/modprobe.d/lockd.conf
    /etc/modprobe.d/tuned.conf
    /etc/abrt/abrt-action-save-package-data.conf
    /etc/abrt/abrt.conf
    /etc/abrt/gpg_keys.conf
    /etc/abrt/plugins/xorg.conf
    /etc/abrt/plugins/oops.conf
    /etc/abrt/plugins/vmcore.conf
    /etc/abrt/plugins/python.conf
    /etc/abrt/plugins/CCpp.conf
    /etc/request-key.conf
    /etc/request-key.d/id_resolver.conf
    /etc/dbus-1/system.d/org.freedesktop.ModemManager1.conf
    /etc/dbus-1/system.d/org.freedesktop.hostname1.conf
    /etc/dbus-1/system.d/avahi-dbus.conf
    /etc/dbus-1/system.d/org.freedesktop.import1.conf
    /etc/dbus-1/system.d/org.freedesktop.locale1.conf
    /etc/dbus-1/system.d/org.freedesktop.login1.conf
    /etc/dbus-1/system.d/org.freedesktop.machine1.conf
    /etc/dbus-1/system.d/org.freedesktop.systemd1.conf
    /etc/dbus-1/system.d/org.freedesktop.timedate1.conf
    /etc/dbus-1/system.d/org.freedesktop.PolicyKit1.conf
    /etc/dbus-1/system.d/org.gnome.GConf.Defaults.conf
    /etc/dbus-1/system.d/org.freedesktop.PackageKit.conf
    /etc/dbus-1/system.d/org.freedesktop.Accounts.conf
    /etc/dbus-1/system.d/org.freedesktop.ColorManager.conf
    /etc/dbus-1/system.d/wpa_supplicant.conf
    /etc/dbus-1/system.d/nm-dispatcher.conf
    /etc/dbus-1/system.d/nm-ifcfg-rh.conf
    /etc/dbus-1/system.d/org.freedesktop.NetworkManager.conf
    /etc/dbus-1/system.d/bluetooth.conf
    /etc/dbus-1/system.d/org.selinux.conf
    /etc/dbus-1/system.d/teamd.conf
    /etc/dbus-1/system.d/dbus-abrt.conf
    /etc/dbus-1/system.d/oddjob.conf
    /etc/dbus-1/system.d/oddjob-mkhomedir.conf
    /etc/dbus-1/system.d/org.freedesktop.realmd.conf
    /etc/dbus-1/system.d/dnsmasq.conf
    /etc/dbus-1/system.d/com.redhat.NewPrinterNotification.conf
    /etc/dbus-1/system.d/org.fedoraproject.SetroubleshootFixit.conf
    /etc/dbus-1/system.d/com.redhat.PrinterDriversInstaller.conf
    /etc/dbus-1/system.d/org.fedoraproject.Setroubleshootd.conf
    /etc/dbus-1/system.d/gdm.conf
    /etc/dbus-1/system.d/org.opensuse.CupsPkHelper.Mechanism.conf
    /etc/dbus-1/system.d/net.reactivated.Fprint.conf
    /etc/dbus-1/system.d/cups.conf
    /etc/dbus-1/system.d/org.freedesktop.bolt.conf
    /etc/dbus-1/system.d/org.freedesktop.RealtimeKit1.conf
    /etc/dbus-1/system.d/pulseaudio-system.conf
    /etc/dbus-1/system.d/nm-libreswan-service.conf
    /etc/dbus-1/system.d/org.freedesktop.UPower.conf
    /etc/dbus-1/system.d/org.freedesktop.GeoClue2.Agent.conf
    /etc/dbus-1/system.d/org.freedesktop.GeoClue2.conf
    /etc/dbus-1/system.d/com.redhat.tuned.conf
    /etc/dbus-1/system.d/org.freedesktop.Flatpak.SystemHelper.conf
    /etc/dbus-1/system.d/org.freedesktop.fwupd.conf
    /etc/dbus-1/system.d/FirewallD.conf
    /etc/dbus-1/session.conf
    /etc/dbus-1/system.conf
    /etc/rsyslog.d/listen.conf
    /etc/mtools.conf
    /etc/sasl2/qemu-kvm.conf
    /etc/sasl2/libvirt.conf
    /etc/sasl2/smtpd.conf
    /etc/cups/cups-browsed.conf
    /etc/cups/classes.conf
    /etc/cups/client.conf
    /etc/cups/cups-files.conf
    /etc/cups/cupsd.conf
    /etc/cups/printers.conf
    /etc/cups/snmp.conf
    /etc/cups/subscriptions.conf
    /etc/gss/mech.d/gssproxy.conf
    /etc/hp/hplip.conf
    /etc/pulse/client.conf
    /etc/pulse/daemon.conf
    /etc/sestatus.conf
    /etc/PackageKit/Yum.conf
    /etc/PackageKit/PackageKit.conf
    /etc/PackageKit/Vendor.conf
    /etc/PackageKit/CommandNotFound.conf
    /etc/NetworkManager/NetworkManager.conf
    /etc/sysctl.conf
    /etc/plymouth/plymouthd.conf
    /etc/samba/smb.conf
    /etc/iscsi/iscsid.conf
    /etc/wpa_supplicant/wpa_supplicant.conf
    /etc/bluetooth/main.conf
    /etc/rsyncd.conf
    /etc/sane.d/abaton.conf
    /etc/sane.d/ricoh.conf
    /etc/sane.d/agfafocus.conf
    /etc/sane.d/apple.conf
    /etc/sane.d/artec.conf
    /etc/sane.d/rts8891.conf
    /etc/sane.d/artec_eplus48u.conf
    /etc/sane.d/s9036.conf
    /etc/sane.d/avision.conf
    /etc/sane.d/bh.conf
    /etc/sane.d/canon.conf
    /etc/sane.d/saned.conf
    /etc/sane.d/canon630u.conf
    /etc/sane.d/sharp.conf
    /etc/sane.d/canon_dr.conf
    /etc/sane.d/sceptre.conf
    /etc/sane.d/canon_pp.conf
    /etc/sane.d/sm3840.conf
    /etc/sane.d/cardscan.conf
    /etc/sane.d/snapscan.conf
    /etc/sane.d/coolscan.conf
    /etc/sane.d/sp15c.conf
    /etc/sane.d/coolscan2.conf
    /etc/sane.d/umax1220u.conf
    /etc/sane.d/coolscan3.conf
    /etc/sane.d/dc210.conf
    /etc/sane.d/dc240.conf
    /etc/sane.d/dc25.conf
    /etc/sane.d/umax_pp.conf
    /etc/sane.d/dell1600n_net.conf
    /etc/sane.d/dll.conf
    /etc/sane.d/dmc.conf
    /etc/sane.d/v4l.conf
    /etc/sane.d/epjitsu.conf
    /etc/sane.d/epson.conf
    /etc/sane.d/epson2.conf
    /etc/sane.d/xerox_mfp.conf
    /etc/sane.d/fujitsu.conf
    /etc/sane.d/genesys.conf
    /etc/sane.d/gphoto2.conf
    /etc/sane.d/gt68xx.conf
    /etc/sane.d/hp.conf
    /etc/sane.d/hp3900.conf
    /etc/sane.d/hp4200.conf
    /etc/sane.d/hp5400.conf
    /etc/sane.d/hpsj5s.conf
    /etc/sane.d/hs2p.conf
    /etc/sane.d/ibm.conf
    /etc/sane.d/kodak.conf
    /etc/sane.d/kodakaio.conf
    /etc/sane.d/leo.conf
    /etc/sane.d/lexmark.conf
    /etc/sane.d/ma1509.conf
    /etc/sane.d/magicolor.conf
    /etc/sane.d/matsushita.conf
    /etc/sane.d/microtek.conf
    /etc/sane.d/microtek2.conf
    /etc/sane.d/mustek.conf
    /etc/sane.d/mustek_pp.conf
    /etc/sane.d/mustek_usb.conf
    /etc/sane.d/nec.conf
    /etc/sane.d/net.conf
    /etc/sane.d/p5.conf
    /etc/sane.d/pie.conf
    /etc/sane.d/pixma.conf
    /etc/sane.d/plustek.conf
    /etc/sane.d/plustek_pp.conf
    /etc/sane.d/qcam.conf
    /etc/sane.d/st400.conf
    /etc/sane.d/stv680.conf
    /etc/sane.d/tamarack.conf
    /etc/sane.d/teco1.conf
    /etc/sane.d/teco2.conf
    /etc/sane.d/teco3.conf
    /etc/sane.d/test.conf
    /etc/sane.d/u12.conf
    /etc/sane.d/umax.conf
    /etc/ndctl/monitor.conf
    /etc/kdump.conf
    /etc/vmware-tools/vgauth.conf
    /etc/numad.conf
    /etc/oddjobd.conf
    /etc/oddjobd.conf.d/oddjobd-introspection.conf
    /etc/oddjobd.conf.d/oddjobd-mkhomedir.conf
    /etc/dnsmasq.conf
    /etc/audisp/audispd.conf
    /etc/audisp/plugins.d/af_unix.conf
    /etc/audisp/plugins.d/syslog.conf
    /etc/audisp/plugins.d/sedispatch.conf
    /etc/audit/auditd.conf
    /etc/setroubleshoot/setroubleshoot.conf
    /etc/speech-dispatcher/clients/emacs.conf
    /etc/speech-dispatcher/clients/gnome-speech.conf
    /etc/speech-dispatcher/modules/cicero.conf
    /etc/speech-dispatcher/modules/dtk-generic.conf
    /etc/speech-dispatcher/modules/epos-generic.conf
    /etc/speech-dispatcher/modules/espeak-generic.conf
    /etc/speech-dispatcher/modules/espeak-mbrola-generic.conf
    /etc/speech-dispatcher/modules/espeak.conf
    /etc/speech-dispatcher/modules/festival.conf
    /etc/speech-dispatcher/modules/flite.conf
    /etc/speech-dispatcher/modules/ibmtts.conf
    /etc/speech-dispatcher/modules/ivona.conf
    /etc/speech-dispatcher/modules/llia_phon-generic.conf
    /etc/speech-dispatcher/modules/swift-generic.conf
    /etc/speech-dispatcher/speechd.conf
    /etc/fprintd.conf
    /etc/pbm2ppa.conf
    /etc/usb_modeswitch.conf
    /etc/radvd.conf
    /etc/chrony.conf
    /etc/ipsec.conf
    /etc/ipsec.d/policies/portexcludes.conf
    /etc/pnm2ppa.conf
    /etc/brltty.conf
    /etc/locale.conf
    /etc/ksmtuned.conf
    /etc/qemu-kvm/bridge.conf
    /etc/qemu-kvm/target-x86_64.conf
    /etc/tcsd.conf
    /etc/libvirt/libvirt-admin.conf
    /etc/libvirt/libvirt.conf
    /etc/libvirt/libvirtd.conf
    /etc/libvirt/virtlockd.conf
    /etc/libvirt/virtlogd.conf
    /etc/libvirt/qemu-lockd.conf
    /etc/libvirt/qemu.conf
    /etc/UPower/UPower.conf
    /etc/geoclue/geoclue.conf
    /etc/dleyna-server-service.conf
    /etc/fwupd/daemon.conf
    /etc/fwupd/remotes.d/fwupd.conf
    /etc/fwupd/remotes.d/lvfs-testing.conf
    /etc/fwupd/remotes.d/lvfs.conf
    /etc/fwupd/remotes.d/vendor.conf
    /etc/fwupd/uefi.conf
    /etc/alsa/state-daemon.conf
    /etc/alsa/alsactl.conf
    /etc/alsa/conf.d/50-pulseaudio.conf
    /etc/alsa/conf.d/99-pulseaudio-default.conf
    /etc/gssproxy/99-nfs-client.conf
    /etc/gssproxy/gssproxy.conf
    /etc/gssproxy/24-nfs-server.conf
    /etc/udisks2/udisks2.conf
    /etc/firewalld/firewalld.conf
    /etc/gdm/custom.conf
    /etc/nfs.conf
    /etc/vconsole.conf
    /etc/nfsmount.conf
    /etc/tuned/tuned-main.conf
    /etc/wvdial.conf
    /etc/updatedb.conf
    /etc/avahi/avahi-daemon.conf
    /etc/mcelog/mcelog.conf
    /etc/smartmontools/smartd.conf
    /etc/rsyslog.conf
    /etc/sudo-ldap.conf
    /etc/sudo.conf

  3. /etc/nginx/ 目录下所有 .conf 文件输出到终端

  4. 查找 /home/ 下所有空文件。

    [root@localhost /]#  find /home/ -size 0
    [root@localhost /]# 

  5. 使用 xargs/var/log/ 下所有 .log 文件

    [root@localhost /]# find /var/log/ -name "*.log" | xargs ls -l  
    -rw-------. 1 root root   24160 5月   8 00:51 /var/log/anaconda/anaconda.log
    -rw-------. 1 root root    2128 5月   8 00:51 /var/log/anaconda/ifcfg.log
    -rw-------. 1 root root 2631328 5月   8 00:51 /var/log/anaconda/journal.log
    -rw-------. 1 root root       0 5月   8 00:51 /var/log/anaconda/ks-script-9zfwCv.log
    -rw-------. 1 root root       0 5月   8 00:51 /var/log/anaconda/ks-script-xbtKVK.log
    -rw-------. 1 root root  571665 5月   8 00:51 /var/log/anaconda/packaging.log
    -rw-------. 1 root root   34836 5月   8 00:51 /var/log/anaconda/program.log
    -rw-------. 1 root root   94499 5月   8 00:51 /var/log/anaconda/storage.log
    -rw-------. 1 root root   31061 5月   8 00:51 /var/log/anaconda/X.log
    -rw-------. 1 root root  277698 5月  13 19:59 /var/log/audit/audit.log
    -rw-------. 1 root root     182 5月  13 18:00 /var/log/boot.log
    -rw-r--r--. 1 root gdm        0 5月  13 09:12 /var/log/gdm/:0-greeter.log
    -rw-r--r--. 1 root root   22224 5月  13 09:13 /var/log/gdm/:0.log
    -rw-r--r--. 1 root root    7470 5月  13 09:12 /var/log/tuned/tuned.log
    -rw-------. 1 root root     775 5月   8 10:22 /var/log/vmware-network.1.log
    -rw-------. 1 root root     775 5月   8 17:52 /var/log/vmware-network.2.log
    -rw-------. 1 root root     775 5月   8 00:53 /var/log/vmware-network.3.log
    -rw-------. 1 root root     775 5月  12 08:20 /var/log/vmware-network.log
    -rw-------. 1 root root 1925789 5月  13 19:59 /var/log/vmware-vmsvc-root.log
    -rw-------. 1 root root    2961 5月  13 09:12 /var/log/vmware-vmtoolsd-root.log
    -rw-------. 1 root root    7600 5月  13 09:10 /var/log/vmware-vmusr-root.log
    -rw-r--r--. 1 root root     200 5月  13 09:13 /var/log/wpa_supplicant.log
    -rw-r--r--. 1 root root   30110 5月  13 09:13 /var/log/Xorg.0.log
    -rw-r--r--. 1 root root   22890 5月   8 00:57 /var/log/Xorg.9.log
    -rw-------. 1 root root      52 5月  12 14:17 /var/log/yum.log

  6. 查找 /usr/lib/ 下所有符号链接文件。

    [root@localhost /]# find /usr/lib/ -type l  
    /usr/lib/debug/usr/.dwz
    /usr/lib/debug/bin
    /usr/lib/debug/lib
    /usr/lib/debug/lib64
    /usr/lib/debug/sbin
    /usr/lib/systemd/systemd-sysv-install
    /usr/lib/systemd/system/initrd.target.wants/dracut-cmdline.service
    /usr/lib/systemd/system/initrd.target.wants/dracut-initqueue.service
    /usr/lib/systemd/system/initrd.target.wants/dracut-mount.service
    /usr/lib/systemd/system/initrd.target.wants/dracut-pre-mount.service
    /usr/lib/systemd/system/initrd.target.wants/dracut-pre-pivot.service
    /usr/lib/systemd/system/initrd.target.wants/dracut-pre-trigger.service
    /usr/lib/systemd/system/initrd.target.wants/dracut-pre-udev.service
    /usr/lib/systemd/system/shutdown.target.wants/dracut-shutdown.service
    /usr/lib/systemd/system/dracut-cmdline.service
    /usr/lib/systemd/system/dracut-initqueue.service
    /usr/lib/systemd/system/dracut-mount.service
    /usr/lib/systemd/system/dracut-pre-mount.service
    /usr/lib/systemd/system/dracut-pre-pivot.service
    /usr/lib/systemd/system/multi-user.target.wants/getty.target
    /usr/lib/systemd/system/multi-user.target.wants/systemd-ask-password-wall.path
    /usr/lib/systemd/system/multi-user.target.wants/systemd-logind.service
    /usr/lib/systemd/system/multi-user.target.wants/systemd-update-utmp-runlevel.service
    /usr/lib/systemd/system/multi-user.target.wants/systemd-user-sessions.service
    /usr/lib/systemd/system/multi-user.target.wants/dbus.service
    /usr/lib/systemd/system/multi-user.target.wants/plymouth-quit-wait.service
    /usr/lib/systemd/system/multi-user.target.wants/plymouth-quit.service
    /usr/lib/systemd/system/dracut-pre-trigger.service
    /usr/lib/systemd/system/dracut-pre-udev.service
    /usr/lib/systemd/system/dracut-shutdown.service

  7. 统计 /var/log/ 目录下每个子目录中的文log件数量。

    [root@localhost etc]# find /var/log/ -name '*.log' > logs | xargs grep -c .log  logs  
    25


3. sort & uniq 命令练习

  1. /etc/passwd 按用户名(第一列)排序并去重。

    [root@localhost /]# cut -d: -f1 /etc/passwd | sort | uniq abrt adm avahi bin chrony colord daemon dbus ftp games gdm geoclue gluster gnome-initial-setup halt libstoragemgmt lp mail nfsnobody nobody ntp operator polkitd postfix pulse qemu qian radvd root rpc rpcuser rtkit saned saslauth setroubleshoot shutdown sshd sync systemd-network tcpdump tss unbound usbmuxd

  2. /var/log/yum.log 按日期(第一列)排序。

    [root@localhost etc]# sort -k1,2 /var/log/yum.log  
    May 12 14:17:19 Installed: tree-1.6.0-10.el7.x86_64
    ​

  3. 合并 /var/log/messages/var/log/secure,去重后保存到 merged_logs.txt

    [root@localhost etc]# cat /var/log/messages /var/log/secure | sort -u > merged_logs.txt  
    May  8 17:58:58 localhost dhclient[3182]: DHCPDISCOVER on ens33 to 255.255.255.255 port 67 interval 8 (xid=0x955d0e7)
    May  8 17:58:58 localhost kernel: e1000: ens33 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
    May  8 17:58:58 localhost kernel: IPv6: ADDRCONF(NETDEV_CHANGE): ens33: link becomes ready
    May  8 17:58:58 localhost kernel: IPv6: ADDRCONF(NETDEV_UP): ens33: link is not ready
    May  8 17:58:58 localhost NET[3147]: /etc/sysconfig/network-scripts/ifdown-post : updated /etc/resolv.conf
    May  8 17:58:59 localhost dhclient[3182]: DHCPACK from 192.168.116.254 (xid=0x955d0e7)
    May  8 17:58:59 localhost dhclient[3182]: DHCPOFFER from 192.168.116.254
    May  8 17:58:59 localhost dhclient[3182]: DHCPREQUEST on ens33 to 255.255.255.255 port 67 (xid=0x955d0e7)
    May  8 17:59:00 localhost avahi-daemon[852]: Registering new address record for fe80::20c:29ff:fe27:976b on ens33.*.
    May  8 17:59:01 localhost avahi-daemon[852]: Joining mDNS multicast group on interface ens33.IPv4 with address 192.168.116.132.
    May  8 17:59:01 localhost avahi-daemon[852]: New relevant interface ens33.IPv4 for mDNS.
    May  8 17:59:01 localhost avahi-daemon[852]: Registering new address record for 192.168.116.132 on ens33.IPv4.
    May  8 17:59:01 localhost dnsmasq[1588]: reading /etc/resolv.conf
    May  8 17:59:01 localhost dnsmasq[1588]: using nameserver 192.168.116.2#53
    May  8 17:59:01 localhost NET[3235]: /usr/sbin/dhclient-script : updated /etc/resolv.conf
    May  8 17:59:02 localhost dhclient[3182]: bound to 192.168.116.132 -- renewal in 718 seconds.

  4. 统计 /var/log/secure 中每个 IP 地址出现的次数(需先排序)。

  5. /etc/group 按组 ID(第三列)数值排序。

    [root@localhost etc]# sort /etc/group -k 3 -n
    abrt:x:173:
    adm:x:4:
    audio:x:63:
    avahi:x:70:
    bin:x:1:
    cdrom:x:11:
    cgred:x:993:
    chrony:x:988:
    colord:x:995:
    daemon:x:2:
    dbus:x:81:
    dialout:x:18:
    dip:x:40:
    disk:x:6:
    floppy:x:19:
    ftp:x:50:
    games:x:20:
    gdm:x:42:
    geoclue:x:985:
    gluster:x:984:
    gnome-initial-setup:x:983:
    input:x:999:
    kmem:x:9:
    kvm:x:36:qemu
    libstoragemgmt:x:996:
    libvirt:x:986:
    lock:x:54:
    lp:x:7:
    mail:x:12:postfix
    man:x:15:
    mem:x:8:
    nfsnobody:x:65534:
    nobody:x:99:
    ntp:x:38:
    polkitd:x:998:
    postdrop:x:90:
    postfix:x:89:
    printadmin:x:997:
    pulse-access:x:990:
    pulse-rt:x:989:
    pulse:x:171:
    qemu:x:107:
    qian:x:1000:qian
    radvd:x:75:
    root:x:0:
    rpcuser:x:29:
    rpc:x:32:
    rtkit:x:172:
    saned:x:994:
    saslauth:x:76:
    setroubleshoot:x:991:
    slocate:x:21:
    sshd:x:74:
    ssh_keys:x:992:
    stapdev:x:158:
    stapsys:x:157:
    stapusr:x:156:
    systemd-journal:x:190:
    systemd-network:x:192:
    sys:x:3:
    tape:x:33:
    tcpdump:x:72:
    tss:x:59:
    tty:x:5:
    unbound:x:987:
    usbmuxd:x:113:
    users:x:100:
    utempter:x:35:
    utmp:x:22:
    video:x:39:
    wheel:x:10:

  6. /var/log/maillog 中提取所有唯一的时间戳(格式 HH:MM:SS)。

  7. du -sh /var/log/* 的输出结果按文件大小降序排序。

    [root@localhost etc]# du -sh /var/log/* | sort -hr  
    26M     /var/log/audit
    3.6M    /var/log/anaconda
    2.2M    /var/log/vmware-vmsvc-root.log
    1.1M    /var/log/messages
    532K    /var/log/sa
    144K    /var/log/gdm
    128K    /var/log/dmesg.old
    128K    /var/log/dmesg
    64K     /var/log/boot.log-20250512
    52K     /var/log/Xorg.0.log.old
    44K     /var/log/lastlog
    40K     /var/log/wtmp
    36K     /var/log/cron
    32K     /var/log/Xorg.0.log
    28K     /var/log/secure
    24K     /var/log/Xorg.9.log
    16K     /var/log/tallylog
    16K     /var/log/boot.log-20250513
    8.0K    /var/log/vmware-vmusr-root.log
    8.0K    /var/log/vmware-vgauthsvc.log.0
    8.0K    /var/log/tuned
    4.0K    /var/log/yum.log
    4.0K    /var/log/wpa_supplicant.log
    4.0K    /var/log/vmware-vmtoolsd-root.log
    4.0K    /var/log/vmware-network.log
    4.0K    /var/log/vmware-network.3.log
    4.0K    /var/log/vmware-network.2.log
    4.0K    /var/log/vmware-network.1.log
    4.0K    /var/log/maillog
    4.0K    /var/log/grubby_prune_debug
    4.0K    /var/log/firewalld
    4.0K    /var/log/cups
    4.0K    /var/log/boot.log
    0       /var/log/swtpm
    0       /var/log/spooler
    0       /var/log/speech-dispatcher
    0       /var/log/samba
    0       /var/log/rhsm
    0       /var/log/qemu-ga
    0       /var/log/ppp
    0       /var/log/pluto
    0       /var/log/libvirt
    0       /var/log/glusterfs
    0       /var/log/chrony
    0       /var/log/btmp

  8. 找出 /etc/passwd 中仅出现一次的用户名(第 1 列)。

    [root@localhost etc]# cut -d: -f1 /etc/passwd | sort | uniq -u  
    abrt
    adm
    avahi
    bin
    chrony
    colord
    daemon
    dbus
    ftp
    games
    gdm
    geoclue
    gluster
    gnome-initial-setup
    halt
    libstoragemgmt
    lp
    mail
    nfsnobody
    nobody
    ntp
    operator
    polkitd
    postfix
    pulse
    qemu
    qian
    radvd
    root
    rpc
    rpcuser
    rtkit
    saned
    saslauth
    setroubleshoot
    shutdown
    sshd
    sync
    systemd-network
    tcpdump
    tss
    unbound
    usbmuxd

  9. /var/log/yum.log 按日期排序,同日期时按时间排序。


建议先备份重要数据,避免误操作!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值