Languages
[Edit]
EN

Bash - detect machine architecture (x86/x64)

8 points
Created by:
Pearl-Hurley
559

In this short article, we would like to show how to check used machine architecture under Bash.

Quick solution:

#!/bin/bash

case "$(uname -m)" in
    *64*)  echo '64bit' ;;
    *686*) echo '32bit' ;;
    *386*) echo '32bit' ;;
    *)     echo '64bit' ;;
esac

 

See also

  1. Bash - detect operating system

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join