FedoraForum.org - Fedora Support Forums and Community
Results 1 to 5 of 5
  1. #1
    Join Date
    May 2017
    Location
    www
    Posts
    135

    Check if Linux is 32-bit or 64-bit

    Is there a way to tell if a program is running 32 bit or 64 bit in Linux?

  2. #2
    Join Date
    Feb 2009
    Posts
    109

    Re: Check if Linux is 32-bit or 64-bit

    Use file command:

    Program:

    file linux/CSVEditor
    linux/CSVEditor: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

    Library:

    file linux/libjni_flat.so
    linux/libjni_flat.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, stripped

  3. #3
    Join Date
    Jan 2010
    Location
    behind that screen...
    Posts
    926

    Re: Check if Linux is 32-bit or 64-bit

    Use the command " uname -i " to see. The architecture is either i386 (32 bit) or x86_64 (64 bit).
    Code:
    $ uname -i
    x86_64

  4. #4
    Join Date
    Nov 2006
    Location
    Detroit
    Posts
    6,659

    Re: Check if Linux is 32-bit or 64-bit

    uname just shows you if the kernel is 32-bit or 64-bit. You can be running a 64-bit kernel and still run 32-bit programs (e.g. Acrobat Reader).
    OS: Fedora 27 x86_64 | Machine: HP Pavilion a6130n | CPU: AMD 64 X2 Dual-Core 5000+ 2.6GHz | RAM: 7GB PC5300 DDR2 | Disk: 400GB SATA | Video: ATI Radeon HD 4350 512MB | Sound: Realtek ALC888S | Ethernet: Realtek RTL8201N

  5. #5
    Join Date
    Jun 2004
    Location
    Laurel, MD USA
    Posts
    7,147

    Re: Check if Linux is 32-bit or 64-bit

    Another option is "readelf -h", the below is a 64bit exe on my host:

    Code:
    ~/local/jdk-9/bin]$ readelf -h javac
    Code:
    ELF Header:
      Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
      Class:                             ELF64
      Data:                              2's complement, little endian
      Version:                           1 (current)
      OS/ABI:                            UNIX - System V
      ABI Version:                       0
      Type:                              EXEC (Executable file)
      Machine:                           Advanced Micro Devices X86-64
      Version:                           0x1
      Entry point address:               0x400a2c
      Start of program headers:          64 (bytes into file)
      Start of section headers:          7928 (bytes into file)
      Flags:                             0x0
      Size of this header:               64 (bytes)
      Size of program headers:           56 (bytes)
      Number of program headers:         8
      Size of section headers:           64 (bytes)
      Number of section headers:         31
      Section header string table index: 28
    Do the same with a 32bit exe, you'd get

    Code:
    ELF Header:
      Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
      Class:                             ELF32
      Data:                              2's complement, little endian
      Version:                           1 (current)
      OS/ABI:                            UNIX - System V
      ABI Version:                       0
      Type:                              EXEC (Executable file)
      Machine:                           Intel 80386
      Version:                           0x1
      Entry point address:               0x80482e0
      Start of program headers:          52 (bytes into file)
      Start of section headers:          5856 (bytes into file)
      Flags:                             0x0
      Size of this header:               52 (bytes)
      Size of program headers:           32 (bytes)
      Number of program headers:         9
      Size of section headers:           40 (bytes)
      Number of section headers:         30
      Section header string table index: 29
    Last edited by marko; 16th August 2017 at 03:57 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •