Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say put a file on the desktop, and when it opens, it opens in the terminal. If I want to do this, what extension can I use in "Save As" of the Text Editor? (e.g. Ubuntu 12.04.2 64-bit

share|improve this question

Some of the extension you can use in Save As when using a text editor, you can use .bat, .sh, .txt.

You can also use xdg-open it opens a file or URL in the user's preferred application.

You can also right click on the file from Nautulis, and choose open in terminal, and if its openable in terminal it will open. To have that added to Nautilus, just look at Add Open in Terminal Command to Nautilus Context Menu

share|improve this answer

The terminal is not for open files with it! You can edit/open/view files from inside of the terminal using commands like nano file_name/xdg-open file_name/cat file_name.

Also (maybe about this thing you are interested) you can run directly in terminal some executable text files (like bash script files). To do this, open Nautilus, go to FilesPreferences, select Behaviour tab and select the option you prefer for executable text files:

file preferences

share|improve this answer
  1. Create the script in your favorite editor for example gedit
  2. At script's first line put a shebang
  3. Save the script somewhere using the .sh extension for example ~/Desktop/
  4. Open Nautilus preferences, at Executable Text Files check the first option Run executable text files when they are opened
  5. Double click to open the script.

As a reference example you can use the following simple bash script which prints a line on terminal:

echo "I am running this executable file"
read -p "Press enter to exit"

When you run the script, a terminal window will open executing the echo and read commands

About shebang: The first line in the script #!/bin/bash "tells" the system which interpreter to use in order to precess the command written in it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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