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?
-
How do you open a file in the terminal? – Braiam Jul 26 '14 at 13:46
-
simply `gnome-text-editor "
"` – Pandya Jul 26 '14 at 13:52 -
2Unclear/misunderstanding that if you want to open file in terminal **or** launching gui app by command-line? – Pandya Jul 26 '14 at 13:55
3 Answers
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 &
- 3,879
- 1
- 19
- 25
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.
- 15,172
- 12
- 70
- 116
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.
- 106,657
- 24
- 210
- 268