As a new Linux "superuser" trying to migrate from Windows 7 I have resisted asking basic questions that can be answered by searching, but I am stuck on this.

When I create an executable file from C with gcc in the Linux terminal, called say hello.exe it is given X permission. Then from the terminal I can run ./hello.exe no problem.

But when I try to run it from Caja it just shows its components as a text file. I can, however, select "Run as administrator" but then I have to enter my login password.

This is irrespective of which of these two settings is enabled:

  • Run executable text files when they are opened.
  • View executable text files when they are opened.

I leave it as the second setting though, otherwise I get asked what I want to do every time I view or edit a text file.

I have tried to launch Caja from the terminal with sudo caja (needs password) but then, Caja won't run the executable at all because the Run option is no longer there.

How can I run an executable from Caja directly: with a double-click?

Edit: Can you run an executable from any file manager with a simple double-click?
Edit 2: Now running Mint Cinnamon with Nemo file manager but the question is basically the same. Am I missing some setting that allows an executable to be run directly?
Edit 3:

During my research I found
GNOME Is Removing the Ability to Launch Binary Apps from Nautilus:

"Or, to put it another way, you won’t be able to double-click on programs, scripts or apps to launch them using Nautilus." (May 2018)

And as I suspect that the file manager authors develop them as derivatives of open source code (or perhaps use common system components), perhaps none of them now do.

I also found this Wikipedia page Comparison of file managers has various tables. The one called File features has the last column as "Run executable files" so I tried out several of those file managers.

  • None of them would run an executable file which I have compiled (and some of them won't even allow easy access to my work drive – which is never the system drive).

But anyway, I have discovered an easy work-around for now, which is that my favourite text editor Geany will run an executable of the current source file, if it exists, from a single click or F5 keypress, without making it into a project.

1 Answer 1


Yes, you can run an executable from a file manager such as Caja.

Say you have a file hello.c in the home directory /home/User containing a simple "hello, world" program with no GUI, such as:

#include <stdio.h>

int main()
    printf("hello, world\n");

and the program is compiled by running gcc -o hello hello.c to generate an executable file hello.

To launch hello from Caja directly, you can provide a launcher that will launch a terminal and run the executable therein, or you can provide the executable with a simple GUI.

If you plan to use a launcher, then before doing anything else (unless you've already done this previously), it would be best to open a terminal, go to Preferences, add a new profile called e.g. "HoldOpen", and set "When command exits" on that profile's "Command" tab to "Hold the terminal open". Otherwise, the terminal will open, run the program, and close before you can see any results when launching from a launcher.

Then create a launcher for the hello program. A launcher is just a text file with a .desktop extension; conceptually, it's something like a Windows shortcut. The .desktop extension is not shown when the file appears in Caja, but it is visible in a directory listing in a terminal. A simple launcher for the purpose which should be saved as hello.desktop is:

[Desktop Entry]
Exec=mate-terminal --profile=HoldOpen -e "/home/User/hello"

A launcher can be written by hand, or (as the one above was) generated by right-clicking on the Desktop, selecting "Create Launcher...", and filling in at least the "Name" and "Command" boxes (the latter corresponding to the "Exec" key).

Double-clicking on the launcher file in Caja should launch hello in its own terminal and display its output therein.

Note that the "Terminal" key is set to "false" because it's actually mate-terminal that is being run, with hello being run in mate-terminal.

Also note that if you use gnome-terminal rather than mate-terminal, you may need to add a couple of newlines before "hello, world" to be able to see the output in the terminal.

For more info on launchers, see the Freedesktop.org Desktop Entry Specification.

An alternative that allows running the program in Caja directly by double-clicking without need for a launcher is to use the Zenity application to generate GUI dialog boxes as needed, thereby providing the program with a simple GUI. You should be able to install Zenity by running sudo apt-get install zenity. Then, , you can replace stdio the printf statement in the hello.c program with stdlib and a system call to display a dialog box:

#include <stdlib.h>

int main()
system("zenity --info --title='Hello' --text='hello, world'");

See man zenity for more info on the Zenity application.

  • Thanks for the input. I reinstalled Mint as Cinnamon (so it's Nemo now not Caja) but I adapted what you advise, without success. The hello.desktop file reports "There was an error launching the application." I then made a launcher on the desktop filling in the two simple fields (name and executable) but I get the same error. The exact same path when typed into the terminal does run the program. Nemo differs from Caja in that it won't even recognise hello as being an executable. It says "The file hello has no known program associated with it" despite its first three bytes being ELF. Apr 18, 2020 at 8:19
  • With regard to the error when using a launcher, make sure the path to your hello file has no spaces in it. Unfortunately, passing a path with spaces to either mate-terminal or gnome-terminal via the -e option (or the synonymous --command option) causes an error, even when the path is enclosed in quotes. A path with spaces can be used, but escaped double-quotes would need to be included, as e.g. "\"/home/User 1/hello\"". Apr 18, 2020 at 12:33
  • Thanks for that, there were no spaces but I tried with and without enclosing quotes anway. I used the dialog provided by the Create Launcher tool in that case, and was able to edit the launcher afterwards. (I would not use double-quotes within any filename, although a few have a single-quote for the apostrophe in a song title, but in such a case I would refer to it by enclosing in double-quotes.) Apr 18, 2020 at 12:46
  • Pre-post tests were on a 64-bit non-Mint system with Caja and both Gnome & Mate Terminals. I retested both alternatives on 32-bit Mint 18.1 Serena \w Mate 1.16.0, Caja 1.16.6, and Mate Terminal; both worked on that as well. (The only difference from the pre-post tests was adding system("sleep 0.5"); following the printf statement with the launcher version; without it, the launcher worked but the terminal didn't show the output; it seems the antique machine being used was too slow to update the screen properly.) Perhaps running on Mint 19.x gives different results. Apr 20, 2020 at 0:33
  • I installed Mint Cinnamon Tricia 19.3 on an ancient x64 dual core machine, as a trial before I commit my main machine, which is Windows 7. For now I am OK with running my little utilities from a terminal. I had thought I was just missing a simple switch to enable a file manager to run an executable, rather than having to set up a launcher for every little thing I want to run. Later on when I make something more substantial, I'll need to research the proper way to install software. Apr 20, 2020 at 16:23

You must log in to answer this question.

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