I'm trying to use xxd
to follow a tutorial but it's not printing anything from the Alpine Linux container that I'm trying to run it in.
I am running: xxd -ps -c 1000 <valid-file-path>
. When I do this, it just prints out the usage instructions:
~ # xxd -ps -c 1000 $FILE_PATH
BusyBox v1.31.1 () multi-call binary.
Usage: xxd [OPTIONS] [FILE]
Hex dump FILE (or stdin)
-g N Bytes per group
-c N Bytes per line
-p Show only hex bytes, assumes -c30
-l LENGTH Show only first LENGTH bytes
-s OFFSET Skip OFFSET bytes
I seem to be calling it correctly according to the printed usage instructions. What am I doing wrong?
Alpine comes with busybox, which is a smaller version of the utilities that come with say, Ubuntu, GNU Coreutils. If you've heard people say "GNU/Linux", this is what they're referring to - many of the utilities you use on the command line were written by the Free Software Foundation.
Busybox xxd
doesn't have the -ps
option because it was rewritten to be smaller. It prints out the usage instructions because -ps
is not valid. If you run this on macos or linux, you'll get different versions of the original xxd
.
As you've found, apk add xxd
will install this "original" xxd.