[SOLVED] For me, strange results from a 'pipe' command
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
OK so I typed this command into a terminal
[CODE]man dmesg > kmsgcmd[CODE]
Sure enough, there is now a kmsgcmd in my home directory, but this is my output from the command:
[QUOTE]DMESG(1) User Commands DMESG(1)
NNAAMMEE
dmesg - print or control the kernel ring buffer
DDEESSCCRRIIPPTTIIOONN
ddmmeessgg is used to examine or control the kernel ring buffer.
The default action is to display all messages from the kernel ring buf‐
fer.
OOPPTTIIOONNSS
The ----cclleeaarr, ----rreeaadd--cclleeaarr, ----ccoonnssoollee--oonn, ----ccoonnssoollee--ooffff, and ----ccoonn‐‐
ssoollee--lleevveell options are mutually exclusive.
--CC, ----cclleeaarr
Clear the ring buffer.
--cc, ----rreeaadd--cclleeaarr
Clear the ring buffer after first printing its contents.
--DD, ----ccoonnssoollee--ooffff
Disable the printing of messages to the console.
--dd, ----sshhooww--ddeellttaa
Display the timestamp and the time delta spent between messages.
If used together with ----nnoottiimmee then only the time delta without
the timestamp is printed.
--EE, ----ccoonnssoollee--oonn
Enable printing messages to the console.
--ee, ----rreellttiimmee
Display the local time and the delta in human-readable format.
Be aware that conversion to the local time could be inaccurate
(see --TT for more details).
--FF, ----ffiillee _f_i_l_e
Read the syslog messages from the given _f_i_l_e. Note that --FF does
not support messages in kmsg format. The old syslog format is
supported only.
--ff, ----ffaacciilliittyy _l_i_s_t
Restrict output to the given (comma-separated) _l_i_s_t of facili‐
ties. For example:
ddmmeessgg ----ffaacciilliittyy==ddaaeemmoonn
will print messages from system daemons only. For all supported
facilities see the ----hheellpp output.
--HH, ----hhuummaann
Enable human-readable output. See also ----ccoolloorr, ----rreellttiimmee and
----nnooppaaggeerr.
--kk, ----kkeerrnneell
Print kernel messages.
--LL, ----ccoolloorr[=_w_h_e_n]
Colorize the output. The optional argument _w_h_e_n can be aauuttoo,
nneevveerr or aallwwaayyss. If the _w_h_e_n argument is omitted, it defaults
to aauuttoo. The colors can be disabled; for the current built-in
default see the ----hheellpp output. See also the CCOOLLOORRSS section be‐
low.
--ll, ----lleevveell _l_i_s_t
Restrict output to the given (comma-separated) _l_i_s_t of levels.
For example:
ddmmeessgg ----lleevveell==eerrrr,,wwaarrnn
will print error and warning messages only. For all supported
levels see the ----hheellpp output.
--nn, ----ccoonnssoollee--lleevveell _l_e_v_e_l
Set the _l_e_v_e_l at which printing of messages is done to the con‐
sole. The _l_e_v_e_l is a level number or abbreviation of the level
name. For all supported levels see the ----hheellpp output.
For example, --nn 11 or --nn eemmeerrgg prevents all messages, except
emergency (panic) messages, from appearing on the console. All
levels of messages are still written to _/_p_r_o_c_/_k_m_s_g, so ssyyss‐‐
llooggdd(8) can still be used to control exactly where kernel mes‐
sages appear. When the --nn option is used, ddmmeessgg will _n_o_t print
or clear the kernel ring buffer.
----nnooeessccaappee
The unprintable and potentially unsafe characters (e.g., broken
multi-byte sequences, terminal controlling chars, etc.) are es‐
caped in format \x<hex> for security reason by default. This
option disables this feature at all. It's usable for example for
debugging purpose together with ----rraaww. Be careful and don't use
it by default.
--PP, ----nnooppaaggeerr
Do not pipe output into a pager. A pager is enabled by default
for ----hhuummaann output.
--pp, ----ffoorrccee--pprreeffiixx
Add facility, level or timestamp information to each line of a
multi-line message.
--rr, ----rraaww
Print the raw message buffer, i.e., do not strip the log-level
prefixes, but all unprintable characters are still escaped (see
also ----nnooeessccaappee).
Note that the real raw format depends on the method how ddmmeessgg(1)
reads kernel messages. The /dev/kmsg device uses a different
format than ssyysslloogg(2). For backward compatibility, ddmmeessgg(1) re‐
turns data always in the ssyysslloogg(2) format. It is possible to
read the real raw data from /dev/kmsg by, for example, the com‐
mand 'dd if=/dev/kmsg iflag=nonblock'.
--SS, ----ssyysslloogg
Force ddmmeessgg to use the ssyysslloogg(2) kernel interface to read kernel
messages. The default is to use /dev/kmsg rather than ssyysslloogg(2)
since kernel 3.5.0.
--ss, ----bbuuffffeerr--ssiizzee _s_i_z_e
Use a buffer of _s_i_z_e to query the kernel ring buffer. This is
16392 by default. (The default kernel syslog buffer size was
4096 at first, 8192 since 1.3.54, 16384 since 2.1.113.) If you
have set the kernel buffer to be larger than the default, then
this option can be used to view the entire buffer.
BBee aawwaarree tthhaatt tthhee ttiimmeessttaammpp ccoouulldd bbee iinnaaccccuurraattee!! The ttiimmee
source used for the logs is nnoott uuppddaatteedd aafftteerr system SSUUSSPPEENNDD/RREE‐‐
SSUUMMEE. Timestamps are adjusted according to current delta be‐
tween boottime and monotonic clocks, this works only for mes‐
sages printed after last resume.
--tt, ----nnoottiimmee
Do not print kernel's timestamps.
----ttiimmee--ffoorrmmaatt _f_o_r_m_a_t
Print timestamps using the given _f_o_r_m_a_t, which can be ccttiimmee,
rreellttiimmee, ddeellttaa or iissoo. The first three formats are aliases of
the time-format-specific options. The iissoo format is a ddmmeessgg im‐
plementation of the ISO-8601 timestamp format. The purpose of
this format is to make the comparing of timestamps between two
systems, and any other parsing, easy. The definition of the iissoo
timestamp is: YYYY-MM-DD<T>HH:MM:SS,<microseconds><-+><timezone
offset from UTC>.
The iissoo format has the same issue as ccttiimmee: the time may be in‐
accurate when a system is suspended and resumed.
--ww, ----ffoollllooww
Wait for new messages. This feature is supported only on sys‐
tems with a readable /dev/kmsg (since kernel 3.5.0).
--WW, ----ffoollllooww--nneeww
Wait and print only new messages.
--xx, ----ddeeccooddee
Decode facility and level (priority) numbers to human-readable
prefixes.
--VV, ----vveerrssiioonn
Display version information and exit.
--hh, ----hheellpp
Display help text and exit.
CCOOLLOORRSS
Implicit coloring can be disabled by an empty file _/_e_t_c_/_t_e_r_m_i_n_a_l_-_c_o_l_‐
_o_r_s_._d_/_d_m_e_s_g_._d_i_s_a_b_l_e. See tteerrmmiinnaall--ccoolloorrss..dd(5) for more details about
colorization configuration.
The logical color names supported by ddmmeessgg are:
ssuubbssyyss The message sub-system prefix (e.g., "ACPI:").
ttiimmee The message timestamp.
ttiimmeebbrreeaakk
The message timestamp in short ctime format in ----rreellttiimmee or
----hhuummaann output.
aalleerrtt The text of the message with the alert log priority.
ccrriitt The text of the message with the critical log priority.
eerrrr The text of the message with the error log priority.
wwaarrnn The text of the message with the warning log priority.
sseeggffaauulltt
The text of the message that inform about segmentation fault.
EEXXIITT SSTTAATTUUSS
ddmmeessgg can fail reporting permission denied error. This is usually
caused by ddmmeessgg__rreessttrriicctt kernel setting, please see ssyysslloogg(2) for more
details.
AAUUTTHHOORRSS
Karel Zak ⟨kzak@redhat.com⟩
ddmmeessgg was originally written by Theodore Ts'o ⟨tytso@athena.mit.edu⟩
AAVVAAIILLAABBIILLIITTYY
The dmesg command is part of the util-linux package and is available
from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
linux/⟩.
util-linux July 2012 DMESG(1)[QUOTE]
Am I seeing something particular to a font? Editing this file is really not feasible, but I do not know how to deal with this situation. Any help would be appreciated.
Last edited by crajor; 01-01-2021 at 10:10 PM.
Reason: CODE and QUOTE tags
It's not a font. nroff produces a bold character C by C<BS>C and an underlined C by _<BS>C. Think of it as of output going to the dot-matrix printer. Try man -H dmesg instead.
Does your man have a man page?
I am reading it now, and it seems that what you want is not as straightforward as one would hope.
OTOH, it should also be possible to display man pages with other commands, as suggested in post #2.
Hmmm... I just tried this and didn't get crajor's result. In any case, as man man will tell you, man pages are encoded in roff, a program that formatted text for dot-matrix printers, which achieved bold-ness by backspacing and printing the character again, underlining by backspacing then printing a _ - you can guess other practices or read roff's man page. That's what you saw when you captured dmesg's man page. Piping through n/g/troff (different platforms use different versions?) will translate back. For instance:
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.