What's new

How to install hexdump?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Ro berto

Regular Contributor
I'm trying to run a script and I need hexdump.

Can someone help me/give me tips?

Thanks
 
I'm trying to run a script and I need hexdump.

Can someone help me/give me tips?

Code:
opkg find *hex*

mcookie - 2.34-1 - mcookie generates a 128-bit random hexadecimal number for use with the X
 authority system

xxd - 8.1-4 - xxd creates a hex dump of a given file or standard input, it can also convert
 a hex dump back to its original binary form.

opkg install xxd

Installing xxd (8.1-4) to root...
Downloading http://bin.entware.net/aarch64-k3.10/xxd_8.1-4_aarch64-3.10.ipk
Configuring xxd.

echo abcd | xxd

00000000: 6162 6364 0a                             abcd.
 
Code:
opkg find *hex*

mcookie - 2.34-1 - mcookie generates a 128-bit random hexadecimal number for use with the X
 authority system

xxd - 8.1-4 - xxd creates a hex dump of a given file or standard input, it can also convert
 a hex dump back to its original binary form.

opkg install xxd

Installing xxd (8.1-4) to root...
Downloading http://bin.entware.net/aarch64-k3.10/xxd_8.1-4_aarch64-3.10.ipk
Configuring xxd.

echo abcd | xxd

00000000: 6162 6364 0a                             abcd.

as always, thanks a bunch @Martineau :D
 
I'm still a newbie, still having issues;

I installed and tested xxd;
Code:
roberto@A:/tmp/home/root# opkg install xxd
Installing xxd (8.1-4) to root...
Downloading http://bin.entware.net/aarch64-k3.10/xxd_8.1-4_aarch64-3.10.ipk
Configuring xxd.
roberto@A:/tmp/home/root# echo abcd | xxd
00000000: 6162 6364 0a                             abcd.

part of the script I'm trying to run:
Code:
roberto@A:/tmp/home/root# echo $(dd bs=1 count=21 if=/dev/urandom 2>/dev/null)|hexdump -v -e '/1 "%02X"'|sed -e s/"0A$"//g
-sh: hexdump: not found
I replaced hexdump witd xxd (maybe it helps but I think it's not):
Code:
roberto@A:/tmp/home/root# echo $(dd bs=1 count=21 if=/dev/urandom 2>/dev/null)|xxd -v -e '/1 "%02X"'|sed -e s/"0A$"//g
xxd V1.10 27oct98 by Juergen Weigert
 
I'm still a newbie, still having issues;

I installed and tested xxd;
Code:
roberto@A:/tmp/home/root# opkg install xxd
Installing xxd (8.1-4) to root...
Downloading http://bin.entware.net/aarch64-k3.10/xxd_8.1-4_aarch64-3.10.ipk
Configuring xxd.
roberto@A:/tmp/home/root# echo abcd | xxd
00000000: 6162 6364 0a                             abcd.

part of the script I'm trying to run:
Code:
roberto@A:/tmp/home/root# echo $(dd bs=1 count=21 if=/dev/urandom 2>/dev/null)|hexdump -v -e '/1 "%02X"'|sed -e s/0A$//g
-sh: hexdump: not found
I replaced hexdump witd xxd (maybe it helps but I think it's not):
Code:
roberto@A:/tmp/home/root# echo $(dd bs=1 count=21 if=/dev/urandom 2>/dev/null)|xxd -v -e '/1 "%02X"'|sed -e s/"0A$"//g
xxd V1.10 27oct98 by Juergen Weigert

Ahh,
Code:
hexdump   -v   -e   '/1   "%02X"'
syntax is converting each of the individual 21 bytes into uppercase 2-char leading zero prefixed strings, concatenated into one single string.
The 'echo' adds the unwanted LF terminator char, that is stripped by the 'sed' command?

Try
Code:
echo $(dd bs=1 count=21 if=/dev/urandom 2>/dev/null) | xxd -u -ps | sed 's/0A$//'
or simply
Code:
head -c 21 /dev/urandom | xxd -u -ps
 
Last edited:
Sorry to resurrect such an old thread, but I figured since I came to this thread looking for the same answer, then others might too.

I found that Entware's version of busybox has hexdump in it. So those looking for hexdump for a script (some configure scripts use it) can simply:
Code:
# opkg install busybox
 
Sorry to resurrect such an old thread, but I figured since I came to this thread looking for the same answer, then others might too.

I found that Entware's version of busybox has hexdump in it. So those looking for hexdump for a script (some configure scripts use it) can simply:
Code:
# opkg install busybox
Installing another version of BusyBox from Entware is generally not recommended as it can create incompatibilities with the installed Asus version.
 
Installing another version of BusyBox from Entware is generally not recommended as it can create incompatibilities with the installed Asus version.
Anything that the Asus scripts are running shouldn't know about or touch binaries in /opt unless since the path they run under won't even include /opt/bin. So it should be pretty safe.

That being said anyone who wants to exercise particular caution can always go to /opt/bin after Entware's busybox is installed and just remove all the soft links that point to /opt/bin/busybox except the one for hexdump:

Code:
for FILE in `find /opt/bin -lname /opt/bin/busybox`; do rm $FILE; done
ln -s /opt/bin/busybox /opt/bin/hexdump

The above makes the Entware busybox basically just an installation of hexdump only. And, if you like, you can also continue on to make softlinks for any other utility in Entware's busybox that you want. As long as it's a utility that isn't also included in the Asus busybox there is no possibility of interference:
Code:
/bin/busybox
/opt/bin/busybox
 
Anything that the Asus scripts are running shouldn't know about or touch binaries in /opt unless since the path they run under won't even include /opt/bin. So it should be pretty safe.
We've had problems with this before. It's not so much Asus' code but third party scripts. /opt/sbin and /opt/bin are included in the default path (even when Entware isn't installed). In a non-interactive environment they're placed at the end of the path but for interactive sessions (or scripts that invoke the Entware profile) they're moved to the front of the path.
 
Way back when, @RMerlin and I sync'ed up our busybox options, and hexdump is one that I think got included (It's included in my LTS fork). With all the GPL churn, that work may have gotten lost. Maybe he can add a review to his to-do list.
 

Similar threads

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top