crash commands can often be verbose, and it's helpful
to control the output, as well as to be able to scroll backwards to
view previous command output.
So, by default, command output that would overflow the user's
display screen is piped to /usr/bin/less,
along with a prompt line that informs the user how to scroll forward,
backward, or to quit the command. For example, here is an example
of what a ps command might look like:
crash> ps
PID PPID CPU TASK ST %MEM VSZ RSS COMM
0 0 0 c030a000 RU 0.0 0 0 [swapper]
1 0 0 cff98000 IN 0.2 1412 468 init
2 1 0 c1446000 IN 0.0 0 0 [keventd]
3 1 0 cfffa000 IN 0.0 0 0 [kapm-idled]
4 0 0 cfff8000 IN 0.0 0 0 [ksoftirqd_CPU0]
5 0 0 cffee000 IN 0.0 0 0 [kswapd]
6 0 0 cffec000 IN 0.0 0 0 [kreclaimd]
7 0 0 c1826000 IN 0.0 0 0 [bdflush]
8 0 0 c1824000 IN 0.0 0 0 [kupdated]
9 1 0 cff90000 IN 0.0 0 0 [mdrecoveryd]
13 1 0 cf07a000 IN 0.0 0 0 [kjournald]
89 1 0 ce804000 IN 0.0 0 0 [khubd]
184 1 0 ce4d4000 IN 0.0 0 0 [kjournald]
572 1 0 cd938000 IN 0.0 440 48 dhcpcd
637 1 0 ce4a4000 IN 0.2 1476 612 syslogd
642 1 0 cd92c000 IN 0.2 2092 432 klogd
663 1 0 ce2bc000 IN 0.2 1564 612 portmap
691 1 0 cd84a000 IN 0.3 1652 668 rpc.statd
803 1 0 cd756000 IN 0.2 1400 452 apmd
828 1 0 cd6c2000 IN 0.3 18024 684 ypbind
830 828 0 cd76e000 IN 0.3 18024 684 ypbind
831 830 0 cd71c000 IN 0.3 18024 684 ypbind |
-- MORE -- forward: <SPACE>, <ENTER> or j backward: b or k quit: q
|
This default output scrolling behavior can be turned off by entering
the following line in a .crashrc file located in either
the $HOME or current directories:
During runtime, the following commands (or their respective builtin aliases) can be used
to turn the scrolling behavior off, and back on, again:
crash> set scroll off
scroll: off
crash> set scroll on
scroll: on
crash> alias
ORIGIN ALIAS COMMAND
builtin man help
builtin ? help
builtin quit q
builtin sf set scroll off
builtin sn set scroll on
builtin hex set radix 16
builtin dec set radix 10
builtin g gdb
builtin px p -x
builtin pd p -d
builtin for foreach
builtin size *
builtin dmesg log
crash> sf
scroll: off
crash> sn
scroll: on
crash>
|
Alternatively, command output may be redirected to a pipe or to
a file using standard shell redirection syntax. For examples:
crash> task | grep uid
uid = 3369,
euid = 3369,
suid = 3369,
fsuid = 3369,
crash> foreach bt > bt.all
crash> ps >> process.data
crash> kmem -p | grep slab > slab.pages
crash>
|
When a command's output is redirected to a pipe or file,
the default /usr/bin/less behavior is turned off for that
particular command.
The default numerical output radix for non-pointer values is decimal,
which is most often noticed when using the builtin gdb capability of
printing formatted data structures.
During runtime, the following commands (or their respective builtin aliases)
can be used to toggle the output radix from decimal to hexadecimal, and back
again:
crash> set radix 16
output radix: 16 (hex)
crash> set scroll 19
output radix: 10 (decimal)
crash> alias
ORIGIN ALIAS COMMAND
builtin man help
builtin ? help
builtin quit q
builtin sf set scroll off
builtin sn set scroll on
builtin hex set radix 16
builtin dec set radix 10
builtin g gdb
builtin px p -x
builtin pd p -d
builtin for foreach
builtin size *
builtin dmesg log
crash> hex
output radix: 16 (hex)
crash> dec
output radix: 10 (decimal)
crash>
|
Alternatively, the px or pd aliases
coerce the "print" command p,
to override the current output radix.
For example, here the changing value of jiffies on a live system
is printed using
the current default radix, then in hexadecimal, and lastly in decimal:
crash> p jiffies
jiffies = $4 = 69821055
crash> px jiffies
jiffies = $5 = 0x42963aa
crash> pd jiffies
jiffies = $6 = 69821656
crash>
|
|