echo -n I | od -to2 | awk '{ print substr($2,6,1); exit}'
or
echo -n I | hexdump -o | awk '{ print substr($2,6,1); exit}'
will give 1 for little endian
http://serverfault.com/questions/163487/linux-how-to-tell-if-system-is-big-endian-or-little-endian