I run an application by opening a terminal then navigating to a directory and executing ./nameofapp. The application opens in terminal and I can operate it with some other commands.

If I try to run the application from file manager, it runs in the background. How can I run it in terminal?

  • How do you open it outside of the command line? Is it a script or is it compiled? – k.stm Sep 16 '18 at 13:10
  • @k.stm It is a executable file, to be concrete, in the "Properties" it says: application/x-executable. – Michael Narper Sep 16 '18 at 13:50
  • That’s not what I meant. In the commandline, what does $ file nameofapp say? Maybe it’s not binary, but a text file. What does $ head -n 3 nameofapp say (the first three lines of the file)? More importantly, how do you open it outsite of the command line? Double-click on it in a file browser? – k.stm Sep 16 '18 at 14:14
  • Yes I double click it, it is a compiled application that when launched only run in the background. – Michael Narper Sep 16 '18 at 14:28

You can write a .desktop file for your application. With terminal option the application should launch in terminal:

[Desktop Entry]
Name=Application Name

Alternatively, you can write a wrapper script that starts terminal and runs your application. For example (gnome-terminal):

exec gnome-terminal -- ./nameofapp
  • I tried the second option and it opens and closes inmediately, when run through terminal with "./name-of-script" it says "exec: gnome-terminal not found". Sorry for my limited knowledge, I am beginner on Linux. – Michael Narper Sep 16 '18 at 15:08
  • You need to call a terminal application installed on system (instead of gnome-terminal). What distribution/desktop environment are you using? – sebasth Sep 16 '18 at 15:16
  • I am using the built-in terminal on Linux 19 Tara – Michael Narper Sep 16 '18 at 15:20
  • Your system possibly uses mate-terminal. Try modifying the script by replacing gnome-terminal with mate-terminal. – sebasth Sep 16 '18 at 15:29
  • it opens the terminal but don't do anything, I guess it is a problem in the app. However, thanks a lot for your answer! – Michael Narper Sep 16 '18 at 15:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.