top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How to find a linux machine endianness ?

+1 vote
How to find a linux machine endianness ?
posted Jun 7, 2015 by Vikram Singh

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

2 Answers

+1 vote
int main()
  int x = 1;
  char *ptr = (char*)&x;

   if (*ptr)
      printf("Little Endianness");
      printf("Big Endianness");

  return 0;

My machine is "Little Endianness" .

answer Jun 7, 2015 by Alok
+1 vote

Try the command lscpu -- it prints out the endianness.

answer Jun 8, 2015 by anonymous
Similar Questions
+3 votes

When I configure my google test framework for a 32 bit machine, I can run all my test cases successfully with no unpredictable behavior. But when I configure it for a 64 bit machine & run my test cases, it gives severe & abrupt crashes. It crashes in places where it is not supposed to. I tried debugging the issue but was out of my depths. I am not sure if there is a problem while configuring the google test framework for 64 bit or maybe it does not support 64 bit. Any help would be appreciated. Please feel free to get in touch if any clarity is required regarding the query I have shared.
Note : The same code base works perfect on a 32 bit machine.

+3 votes

I want to write a java program to connect a linux machine to check its CPU usage in every 5 minute.
I have details like ip, username and password of that particular machine.
Can anyone share a sample for this?

+2 votes

Please share a sample program with detail code.

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.