Linux Commands Examples

A great documentation place for Linux commands


change reported architecture in new program environment and set personality flags


setarch arch [options] [program [arguments]]
[options] [program [arguments]]

add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!



setarch ppc32 rpmbuild --target=ppc --rebuild foo.src.rpm
setarch ppc32 -v -vL3 rpmbuild --target=ppc --rebuild bar.src.rpm
setarch ppc32 --32bit rpmbuild --target=ppc --rebuild foo.src.rpm


Should I choose 32 or 64 bit for Linux?

To use all 8 GB naturally you should install 64-bit version.


How to run a minimal Linux inside a running 64-bit Windows 7

I would go for the Xming + ssh -X solution.

1) I’m not sure - but you could run your Virtual Mashine in headless mode and launch applications through SSH. That would be pretty non-intrusive,

2) I would.

3) If its a minimal distro you should be fine with a couple of GB of space for the root filesystem / and around 200mb RAM.

4) Yes


How to tell if linux process is 64bit

You can use file to get that information:

For example:

chris@obsidian:~$ file /usr/bin/perl
/usr/bin/perl: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), for GNU/Linux 2.6.8, dynamically linked (uses shared libs), stripped

or read from /proc/

chris@obsidian:~$ file -L /proc/[PID]/exe
/proc/[PID]/exe: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.8, dynamically linked (uses shared libs), stripped

This will tell you if it is 64 or 32-bit.


How to reinstall GRUB2 EFI?

  • Boot your computer with a live-usb/CD in UEFI mode. I had two boot options <flash_drive> and UEFI: <flash_drive>, the second is needed to expose the efi variables in /sys/firmware/efi/ so that efibootmgr don't fail later on. Booting with the first option gives me the following error:

    Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
    Try 'modprobe efivars' as root.

    modprobe efivars did'nt work for me.

  • chroot into the broken system (similar to the ubuntu grub2 help but with efi specificities):

    sudo mount /dev/sda2 /mnt #sda2 is my root partition
    sudo mount /dev/sda1 /mnt/boot/efi #sda1 is my efi partition
    for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt$i; done
    sudo cp /etc/resolv.conf /mnt/etc/ #makes the network available after chrooting
    modprobe efivars # make sure this is loaded
    sudo chroot /mnt
  • Depending on your linux distribution, you now do different things.

    • For Ubuntu/Debian:

      apt-get install --reinstall grub-efi-amd64
      or alternatively: 
      apt-get install --reinstall grub-efi
      should the above give you a grub, but not a bootable one
    • For Fedora (up to 16, may work for others):

      yum reinstall grub-efi

      In the following command, you have to replace sdX with the device which has the EFI partition you want to boot from. In --part Y you have to replace the Y with the number of the EFI partition (as in /dev/sdXY).

      efibootmgr -c --disk /dev/sdX --part Y
      efibootmgr -v # verify a new record called Linux is there
  • Now type Ctrl+D to exit chroot, unmount everything and reboot:

    for i in /sys /proc /dev/pts /dev; do sudo umount /mnt$i; done
    sudo umount /mnt/boot/efi #please do this. corrupted efi partitions are not nice
    sudo umount /mnt
    sudo reboot

You may need to adapt this to your needs (different partition table, separate /boot partition, etc.) and it may not be the only option but this worked just fine for me.

A suitable live-system for fixing things is grml. There is also an extensive guide on how to setup a bootable USB device, of which the Mac section is the most useful actually (just create FAT32 partition, copy the files, reboot, done).


Bare-metal virtualisation for the desktop

VirtualBox appears to be one of the best virtualisation tools. Combined with Linux + Virtualisation features on chip its great.

I'm not sure what you mean by "bare metal", but you can't run things that close, there has to be some visualization ( even if it is a kernel hyper visor )

It has this cool trick it does where, when using its own video drivers in windows, can mix windows apps into your linux desktop with a fancy compositing trick. ( effectively, the windows desktop becomes transparent and the app drops its borders and does other fancy reporting tricks ) and it becomes like running X11 on Windows ( its creepy, really )


Ubuntu 64-bit vs 32-bit

Why not try both and decide for yourself? You can always backup your homedir and migrate it to the version you intend to keep.

I don't know if it's the placebo effect or something else, but I seem to think that 64-bit feels faster on the same hardware.


How do I know if my linux kernel is running in 32bit or 64bit?

uname -a

will tell you the kernel - the end bit tells you the architecture.

Two examples:

My mac:

Darwin Mac.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386

My Dreamhost hosting:

Linux ecco #1 SMP Tue Oct 7 06:18:04 PDT 2008 x86_64 GNU/Linux

i386 = 32 bit

x86_64 = 64 bit


Linux command to return number of bits (32 or 64)?

You can use uname -a and look for x86_64 to see if you are running 64-bit. Anything else (As far as I know) and you are running 32-bit or you are on non-PC hardware such as alpha, sparc, or ppc64.


Install 64-bit Ubuntu or 32-bit?

Plus sides:

  • It will be slightly faster. While 64bit vs 32bit apps don't make a huge performance difference, developers can make assumptions about speed-related features being present in 64-bit processors that they can't with 32bit apps.
  • You can use all 4GB of RAM, as opposed to roughly 3.2GB. (There are ways around this for 32bit systems, but it's not simple)

Negative sides:

  • While nowadays you won't find many apps that just don't work on 64bit, there are some (Adobe Air comes to mind), that do require more effort to install.

Getting a GPU Bitcoin miner for Linux 64bit

In my experience, Linux is far better supported by the Bitcoin community than Windows is. The same goes for ATI vs. Nvidia; ATI cards are far better at doing the calculations required for mining bitcoins, so all the serious miners use them. 32 vs. 64 bit should also be a non-issue; just pick the 64-bit version of the AMD Stream SDK instead of the 32-bit version.

Here's a guide for setting up the Phoenix and poclbm miners on Ubuntu 11.04. Setup should be roughly similar on other distributions.


setarch This utility currently only affects the output of uname -m. For example, on an AMD64 system, running ’setarch i386 program’ will cause ’program’ to see i686 (or other relevant arch) instead of x86_64 as machine type. It also allows to set various personality options. The default program is /bin/sh.


-v, --verbose

Be verbose.

-h, --help

Display help (it is also displayed when setarch takes no arguments).


Causes the program to see a kernel version number beginning with 2.6.

-3, --3gb

Specifies that processes should use a maximum of 3GB of address space on systems where it is supported (ADDR_LIMIT_3GB).

-B, --32bit

Turns on ADDR_LIMIT_32BIT.

-F, --fdpic-funcptrs

Userspace function pointers point to descriptors (turns on FDPIC_FUNCPTRS).

-I, --short-inode


-L, --addr-compat-layout

Changes the way virtual memory is allocated (turns on the ADDR_COMPAT_LAYOUT).

-R, --addr-no-randomize

Disables randomization of the virtual address space (turns on ADDR_NO_RANDOMIZE).

-S, --whole-seconds


-T, --sticky-timeouts


-X --read-implies-exec


-Z, mmap-page-zero



The setarch command is part of the util-linux package and is available from


Elliot Lee <sopwith[:at:]redhat[:dot:]com>
Jindrich Novy <jnovy[:at:]redhat[:dot:]com>

How can this site be more helpful to YOU ?

give  feedback