When running a .net program on Ubuntu I have to type in "mono foo.exe" instead of just foo.exe or double-clicking the icon. Is there any way to just run foo.exe?

4 Answers 4


Does this link help? Running Mono

From the Mono Project on using binfmt:

Registering .exe as non-native binaries (Linux only)

Because this is a Linux-specific feature, we do not recommend that developers deploy this solution, as it would limit the portability of their scripts.

In addition, this mechanism does not work as intended by the Application Deployment Guidelines.

You can also make a systemwide change, and use binfmt to register the exe files as non-native binaries. Then, when trying to launch an exe file, the kernel will run the mono interpreter to handle the command. Binfmt can also be used to launch Windows executables using WINE, or Java .class files using a JVM. To register exe with the kernel:

Become root and turn on the binfmt module in your kernel with this command:

sudo apt-get install binfmt-support
modprobe binfmt_misc

In addition, you may want to add the modprobe command to your /etc/rc.local boot script, so that it will be executed on boot.

Add the line below to your /etc/fstab file:

binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc none

Then, have your system run the following command on boot:

echo ':CLR:M::MZ::/usr/bin/mono:' > /proc/sys/fs/binfmt_misc/register

Be sure to mark your .exe files as executable in the filesystem as well:

chmod +x myprogram.exe

Note that this doesn't change your kernel, just the modules that it loads when you boot your system. In other words, you can still upgrade your kernel without worrying about losing these changes. Similarly, you can upgrade your Mono runtime without affecting any of the invocation methods listed in this section.

  • +1 for binfmt_misc option, which is the smallest workaround on Linux
    – mario
    Jan 6, 2011 at 2:17
  • 1
    got FATAL: Module binfmt not found in 12.04
    – RiaD
    Aug 17, 2012 at 18:47

Create a startup script.

Open a plain text editor, add this:

mono foo.exe &

Depending on your setup, you may need to use the full path for foo.exe.

Save the file for example as foo.sh.

Make it executable:

sudo chmod a+x foo.sh

You should now be able to start foo.exe by double-clicking foo.sh.


You can associate the file extension '.exe' on Nautilus to be executed with /usr/bin/mono


I know this is an old question but I found it through google and it got me thinking. This is a major hack but you could download


to your home and add the following to .bashrc

source ~/.bash-preexec.sh
preexec() {
  if [[ $1 =~ [^\s]+\.exe$ ]]; then
    eval "$1() { return 1; }"
    export -f $1
    /usr/bin/mono $1
precmd() { [[ $1 =~ [^\s]+\.exe$ ]]; unset -f $1; }

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .