Skip to content

hexedit | Cheatsheet

How it works

Command Description
s=$(echo "wuseman power :)" rev)
hex="" Creates an empty variable hex to store the hexadecimal values.
for (( i=0; i<${#s}; i++ )) loops through each character in the s string.
hex+="\((printf "%02x" "'\)")" Converts each character to its hexadecimal value using the printf command and appends it to the hex variable.
echo ${hex^^} Prints the hex variable in uppercase (uppercase hexadecimal values).
#!/bin/bash

s=$(echo "wuseman power :)" | rev)
hex=""
for (( i=0; i<${#s}; i++ )); do
  hex+="$(printf "%02x" "'${s:i:1}")"
done

echo ${hex^^}