3

I could not find the section as you can open the file in a graphics mode, that is such a file 1.txt terminal displays the contents but I would love to see it with the gedit or another text editor?

Braiam
  • 66,947
  • 30
  • 177
  • 264
Andrew
  • 41
  • 1
  • 1
  • 6

3 Answers3

5

You can do that by entering the program name before the file name.

So to open index.html with gedit from a terminal you would use :

gedit index.html

It should be noted that this will run from the terminal, if you want to separate it and continue using the terminal simply add an & after the command, for example :

gedit index.html &
Fernhill Linux Project
  • 3,879
  • 1
  • 19
  • 25
5

Opening a text file in a text editor is as simple as Fernhill Linux Project's answer.

For a more generic "open with default program" command you may type xdg-open filename.

A video file would open with your default video player, a text file with your default text editor, etc.

This has the added advantage that you may close the terminal window without closing the application.

To Do
  • 15,172
  • 12
  • 70
  • 116
0

You would just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

<program_name>
or
sudo <program_name>

To open a .txt file using gedit from terminal, you would do

gedit <file_name>

Note: Make sure that the program that you're trying to open is in your path; otherwise you have to enter the complete path.

Mitch
  • 106,657
  • 24
  • 210
  • 268