9

I actually just have shared hosting at Dreamhost, and I'm going to use it to test deploying a MongoDB based application. There are 32-bit and 64-bit pre-built distros, but I don't know which I should install, until I can determine the server's architecture.

I suppose this can be done by detecting the OS version, but I have no idea how to do that. I can ssh in, though not as root of course, since it's a shared server. I just need to know what command or commands can tell me what architecture is being run on.

2

6 Answers 6

16

"uname -m" or "arch"

6

The command on Linux/UNIX is:

uname -a 

or for just the architecture:

uname -m
6

From commandlinefu.com:

getconf LONG_BIT
1
  • This is the one you want if you are trying to help out someone who is unfamiliar with how being 32/64-bit ties in with the architecture. Whereas most other commands listed here will output i*86 32-bit systems, this one actually tells the user what they are probably looking for in the first place.
    – Chris Down
    Jan 23, 2013 at 13:25
1

I think uname may just show you the version of the operating system that's installed, rather than the underlying hardware architecture. To double check, try:

cat /proc/cpuinfo
2
  • Although true, for his purpose it's irrelevant. He's not installing the OS, he's installing an app on the OS and wants to know which arch of the app to install.
    – Swoogan
    Sep 2, 2009 at 21:58
  • It is possible that uname could report i386 or i686 for the kernel. and cpuinfo has a flag for "lm" which means the HW is 64bit. This would mean that your ISP is running a 32bit OS on 64bit architecture. This doesn't change the correct answer but may be useful to know.
    – keithosu
    Sep 3, 2009 at 19:33
1

lshw shows the processor register width like this:


sudo lshw -class processor

0

there are five different ways in which it can be done:

  1. uname -a

  2. uname -m

  3. file /sbin/init

  4. arch

  5. through system settings, (for ubuntu > 12.04)

For more details see this blog post

Not the answer you're looking for? Browse other questions tagged .