dmesg的输出显示自系统启动以来的秒数+毫秒数。
[ 10.470000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[ 14.610000] device eth0 entered promiscuous mode
[ 18.750000] cfg80211: Calling CRDA for country: DE
[ 18.750000] cfg80211: Regulatory domain changed to country: DE
问:如何将秒+毫秒设置为可读格式?
我的dmesg:
root@OpenWrt:/tmp# dmesg -h
dmesg: invalid option -- h
BusyBox v1.19.4 (2013-03-14 11:28:31 UTC) multi-call binary.
Usage: dmesg [-c] [-n LEVEL] [-s SIZE]
Print or control the kernel ring buffer
-c Clear ring buffer after printing
-n LEVEL Set console logging level
-s SIZE Buffer size
因为没有太多可用空间,所以无法安装util-Linux:
root@OpenWrt:~# df -h
Filesystem Size Used Available Use% Mounted on
rootfs 1.1M 956.0K 132.0K 88% /
/dev/root 2.0M 2.0M 0 100% /rom
tmpfs 14.3M 688.0K 13.6M 5% /tmp
tmpfs 512.0K 0 512.0K 0% /dev
/dev/mtdblock3 1.1M 956.0K 132.0K 88% /overlay
overlayfs:/overlay 1.1M 956.0K 132.0K 88% /
。
root@OpenWrt:/tmp# which awk perl sed bash sh shell tcsh
/usr/bin/awk
/bin/sed
/bin/sh
root@OpenWrt:~# date -h
date: invalid option -- h
BusyBox v1.19.4 (2013-03-14 11:28:31 UTC) multi-call binary.
Usage: date [OPTIONS] [+FMT] [TIME]
Display time (using +FMT), or set time
[-s,--set] TIME Set time to TIME
-u,--utc Work in UTC (don't convert to local time)
-R,--rfc-2822 Output RFC-2822 compliant date string
-I[SPEC] Output ISO-8601 compliant date string
SPEC='date' (default) for date only,
'hours', 'minutes', or 'seconds' for date and
time to the indicated precision
-r,--reference FILE Display last modification time of FILE
-d,--date TIME Display TIME, not 'now'
-D FMT Use FMT for -d TIME conversion
-k Set Kernel timezone from localtime and exit
您所说的“可读”格式是什么?
—
UVV
恐怕那时您可能不走运。如果您的系统将内核输出记录到某种日志中(例如,
—
Martin von Wittich 2014年
/var/log/syslog
在Debian系统上,请检查该日志;它可能包含相同的信息,但带有可读的时间戳。)
嗯,这将非常复杂,因为您似乎无法使用日期处理功能访问任何内容。您的
—
terdon
date
命令不支持该-d
标志,对吗?我猜也没有python吗?这awk
是哪个实现?它是GNU awk
至少?
太好了,如果您有
—
terdon
date -d
,我更新的答案应该可以了。