Finding Endianness in Linux and Solaris

How to find Endiness of a System in Linux and Solaris

Solaris
$ echo -n I | od -to2 | head -n1 | cut -f2 -d" " | cut -c6
0
Linux
$ echo -n I | od -to2 | head -n1 | cut -f2 -d" " | cut -c6
1
Using python
$ python -c "import sys; print(sys.byteorder)"
big
$ python -c "import sys; print(sys.byteorder)"
little
Comments