Jump to content
Sign in to follow this  
Fernando Mercês

Descobrindo se um Linux é de 64-bits

 Read less than a minute

Recommended Posts

 Read less than a minute

A tarefa não é difícil, mas decidi mostrar como faço. :-)

A maneira rápida quando tenho shell:

$ file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=a0823e17cafbe5b2296346216445566840fdfd88, stripped

Programaticamente em C (8 bytes significam 64 bits).

$ echo 'main(){printf("%d\n", sizeof(void *));}' | tcc -run -

Só pra ver se o processador suporta:

$ grep --color -w lm /proc/cpuinfo

O clássico:

$ uname -a
Linux linux64 3.16.0-4-amd64 #1 SMP Debian 3.16.43-2+deb8u3 (2017-08-15) x86_64 GNU/Linux

Ou pelo nome dos arquivos do kernel:

$ ls /boot
config-3.16.0-4-amd64  grub  initrd.img-3.16.0-4-amd64    System.map-3.16.0-4-amd64  vmlinuz-3.16.0-4-amd64

Tem outra maneira de fazer? :-)

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...