もた日記

くだらないことを真面目にやる

Linuxメモ : Rust製のhexylコマンドで色分け16進数表示

hexyl

github.com

hexylはRust製のコマンドラインHEX(16進数)viewer 。
下記パターンで色分け表示できる。

  • NULL bytes
  • printable ASCII characters
  • ASCII whitespace characters
  • other ASCII characters
  • non-ASCII

f:id:wonder-wall:20190307230413p:plain

インストール

各環境でのインストール方法はこのページに書いてある。
バイナリはこのページからダウンロードでき、 Rust製なのでcargo installでインストールできる。

$ cargo install hexyl

ヘルプメッセージ。

$ hexyl --help
hexyl 0.4.0
A command-line hex viewer

USAGE:
    hexyl [file]

OPTIONS:
    -n, --length <N>      Read only N bytes from the input
        --color <when>    When to use colors. The auto-mode only displays colors if the output goes to an interactive terminal [default: always]  [possible values: always,
                          auto, never]
    -h, --help            Prints help information
    -V, --version         Prints version information

ARGS:
    <file>    File to display

使い方

hexylの後にファイルを指定すればよい。

f:id:wonder-wall:20190307225420p:plain

上記ファイルをheyxl, hexdumpした結果が下図。

f:id:wonder-wall:20190307225433p:plain