Linux: Big Endian Little Endian test from command line

echo -n I | od -to2 | head -n1 | cut -f2 -d" " | cut -c6 

If it return 0, it’s Big Endian

If it returns 1, it’s Little Endian

Reference:

http://serverfault.com/questions/163487/linux-how-to-tell-if-system-is-big-endian-or-little-endian

 

Advertisements
This entry was posted in Linux and tagged , , . Bookmark the permalink.

2 Responses to Linux: Big Endian Little Endian test from command line

  1. Tim says:

    on my system, 5 is output…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s