Skip to content
shellmap

odDump file bytes in octal, hex, or character form for inspection across all 5 shells

Equivalents in every shell

Bashunix
od -c file.bin

`-c` prints ASCII with escape sequences (`\n`, `\t`, `\0`). Other formats: `-x` hex (default short word), `-X` hex-long, `-d` decimal, `-o` octal (default!). Address radix: `-A x` (hex addresses), `-A d` (decimal). Combine: `od -A x -t x1z` is the "xxd-like" form.

Zshunix
od -c file.bin

Same external binary. Zsh has no built-in equivalent. For interactive hex inspection, `xxd file.bin | less` is more readable than `od` defaults.

Fishunix
od -c file.bin

Same external binary. `xxd` (typically packaged with vim) is the more user-friendly alternative.

PowerShellwindows
Format-Hex file.bin

Pwsh-native hex+ASCII dump. Output column layout matches the standard 16-byte-per-row format with offset, hex bytes, and ASCII gutter. `-Count N` limits bytes; `-Offset N` skips. For octal/decimal display, post-process: `Get-Content file.bin -Encoding Byte | ForEach-Object { "{0:o}" -f $_ }`.

cmd.exewindows
certutil -dump file.bin

`certutil -dump` is the closest native cmd hex-dump (originally a cert-inspection tool, but works on any file). Output is hex + ASCII similar to `Format-Hex`. No octal mode. For richer formatting, shell out to pwsh `Format-Hex` or install `xxd` via Git for Windows.

Worked examples

Hex dump first 64 bytes of a binary

Bash
od -A x -t x1z -N 64 file.bin
Fish
od -A x -t x1z -N 64 file.bin
PowerShell
Format-Hex file.bin -Count 64

Inspect binary characters with escape sequences

Bash
od -c file.bin | head
Fish
od -c file.bin | head
PowerShell
Get-Content file.bin -Encoding Byte -TotalCount 256 | ForEach-Object { if ($_ -ge 32 -and $_ -lt 127) { [char]$_ } else { "\$($_.ToString(\"x2\"))" } }

Spot the BOM at the start of a file (UTF-8 = `ef bb bf`, UTF-16LE = `ff fe`)

Bash
od -A x -t x1 -N 3 file.txt
Fish
od -A x -t x1 -N 3 file.txt
PowerShell
(Get-Content file.txt -Encoding Byte -TotalCount 3 | ForEach-Object { "{0:x2}" -f $_ }) -join " "

Gotchas

  • POSIX `od` default mode is OCTAL words, not hex bytes (`-o`) — counterintuitive for anyone trained on `hexdump`/`xxd`. Always specify the format explicitly: `od -t x1` for hex bytes, `-t c` for chars. The bare `od file.bin` output is rarely what you want.
  • BSD `od` (macOS) and GNU `od` agree on `-c`, `-A`, `-t`, but BSD lacks the `-w N` width-override flag. For 32-bytes-per-row across both: GNU `od -w 32 -A x -t x1z` works; BSD needs `od -A x -t x1z` + post-process with `awk` to re-flow.
  • `-t x1z` (the "xxd-like" form: 1-byte hex with ASCII gutter) is GNU-only — BSD `-t x1` works but `z` (the ASCII column) doesn't. For BSD-compatible "hex + ASCII sidebar" output, prefer `xxd file.bin` directly (BSD `od` has no exact equivalent).
  • pwsh `Format-Hex` requires the input file to fit in memory by default. For very large binaries, use `-Count` to limit, or chunk read via `.NET`: `$fs = [IO.File]::OpenRead("huge.bin"); $buf = New-Object byte[] 1024; $fs.Read($buf, 0, 1024); Format-Hex -InputObject $buf`.
  • cmd `certutil -dump` writes ALL output to stdout including a Microsoft-style header — pipe through `findstr` to filter, or use `certutil -dump -encodehex file.bin out.txt` to get encoder-friendly hex-only output. The legacy `debug.exe`/`debug.com` tools were removed from Windows 10+.

WSL & PowerShell Core notes

pwsh`Format-Hex` is the pwsh-native cross-OS hex dump — works identically on Windows / Linux / macOS pwsh. For interactive use it's more readable than `od`. Limitation: no octal / decimal display modes — for those, fall back to `Get-Content -Encoding Byte` + `ForEach-Object` with format string.
WSLWSL `od` is GNU coreutils — full flag set. For interactive binary inspection, install `xxd` (`apt install xxd` or `apt install vim-common`) — `xxd file.bin | less` is the most readable form and works identically on every Linux distro.

Related commands