Without any DE or even X, I want to use ./my.exe to run mono my.exe, like it works with python scripts.


3 Answers 3


Bash has no such feature. Zsh does, you can set up aliases based on extensions:

alias -s exe=mono

This would only work in an interactive shell, however, not when a program invokes another.

Under Linux, you can set up execution of foreign binaries through the binfmt_misc mechanism; see Rolf Bjarne Kvinge. Good Linux distributions set this up automatically as part of the mono runtime package.

If you can't use binfmt_misc because you don't have root permissions, you'll have to settle for wrapper scripts.

exec /path/to/mono "$0.exe" "$@"

Put the wrapper script in the same directory as the .exe file, with the same name without .exe.


It is possible:

  • Become root and turn on the binfmt module in your kernel with this command (you may want to add this command to your /etc/rc.local boot script, so that it will be executed on boot):

    modprobe binfmt

  • 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

(from here: http://mono-project.com/Guide)

Note that this is not the recommended way, read the above mentioned Guide page and also the page on how to do application deployment for mono applications.

  • I see, truly I better make loader for each .exe I need
    – cnd
    Commented Sep 6, 2012 at 8:28

You might be able to embed the file inside a bash script using the following guide http://www.linuxjournal.com/content/add-binary-payload-your-shell-scripts

You must log in to answer this question.

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