How to Determine Linux OS Endian (Big Endian / Little Endian)

Below command lines are based on the “google search” and we have tested them in our Red Hat operating system. Unfortunately, we only have Little Endian type of system, so no Big Endian output. If you have any Big Endian system, please share the output at the comment section.

Command 1

echo I | tr -d [:space:] | od -to2 | awk 'FNR==1{ print substr($2,6,1)}'

Command 2

printf '\1' | od -dAn

Command 3

lscpu | grep Endian

Command 4

echo -n I | od -to2 | awk '{ print substr($2,6,1); exit}'

Command 5

python -c "import sys; print(sys.byteorder)"

Note:

  • Some command may not be working in certain Linux operating system.
  • If you get the output of 1, your system is Little Endian.

You May Also Like

Leave a Reply?