Fedora Linux Support Community & Resources Center
  #1  
Old 15th August 2017, 07:05 PM
tryfedoraa Offline
Registered User
 
Join Date: May 2017
Location: www
Posts: 120
windows_98_nt_2000chrome
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?
Reply With Quote
  #2  
Old 15th August 2017, 07:36 PM
tankist02 Offline
Registered User
 
Join Date: Feb 2009
Posts: 107
windows_7chrome
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
Reply With Quote
  #3  
Old 15th August 2017, 08:57 PM
solo2101 Offline
Registered User
 
Join Date: Jan 2010
Location: behind that screen...
Posts: 917
linuxfedorafirefox
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
Reply With Quote
  #4  
Old 16th August 2017, 02:57 AM
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 6,633
linuxfedorafirefox
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 26 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
Reply With Quote
  #5  
Old 16th August 2017, 03:25 AM
marko Offline
Registered User
 
Join Date: Jun 2004
Location: Laurel, MD USA
Posts: 7,118
linuxfedorafirefox
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.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Current GMT-time: 12:31 (Thursday, 21-09-2017)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat