linux命令dmesg用法详解

 

功能说明:显示开机信息。
语  法:dmesg [-cn][-s <缓冲区大小>]
补充说明:kernel会将开机信息存储在ring buffer中。您若是开机时来不及查看信息,可利用dmesg来查看。开机信息亦保存在/var/log目录中,名称为dmesg的文件里。
参  数:
-c  显示信息后,清除ring buffer中的内容。 
-s<缓冲区大小>  预设置为8196,刚好等于ring buffer的大小。 
-n  设置记录信息的层级。

 

Linux命令dmesg用来显示开机信息,kernel会将开机信息存储在ring buffer中。
您若是开机时来不及查看信息,可利用dmesg来查看。
开机信息亦保存在/var/log目录中,名称为dmesg的文件里。
也可用cat /var/log/messages查看

示例
  将系统启动信息保存到文件中:
         $ dmesg > messages.txt

       打印输出最近一次的信息:
        $ dmesg | tail -f

      打印输出最近8次的信息:
        $ dmesg | tail -8

 

[root@localhost ~]# dmesg | tail -f
SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
Adding 1048568k swap on /dev/VolGroup00/LogVol01.  Priority:-1 extents:1
SELinux: initialized (dev binfmt_misc, type binfmt_misc), uses genfs_contexts
parport0: PC-style at 0x378 [PCSPP,TRISTATE]
ip_tables: (C) 2000-2002 Netfilter core team
ip_conntrack version 2.1 (4096 buckets, 32768 max) - 340 bytes per conntrack
SELinux: initialized (dev rpc_pipefs, type rpc_pipefs), uses genfs_contexts
parport0: PC-style at 0x378 [PCSPP,TRISTATE]
lp0: using parport0 (polling).
lp0: console ready
tail: standard input: file truncated
tail: standard input: cannot seek to offset 0: 非法 seek 操

 

 

GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:22 天前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐