Updating contents of a file with gedit from ubuntu terminal

2.3k Views Asked by At

I have type "gedit filename.txt" on my command line in Ubuntu, but no Gedit window showed up. Instead my cursor keeps flashing, as if I could write things, but I have no way to type commands that work ... I tried pressing escape then ":wq" but nothing happened. How can I go back to my command line normally, and how do I update files with gedit from the command line ? Hope this is clear, please ask if not.

2

There are 2 best solutions below

2
On BEST ANSWER

Are you using Gnome or are you in a shell? For console based editing, you should use vi or nano or some other console editor. Gedit will only work if you're using a window based graphical interface. (Gnome) (also depending on the file, you might need to sudo to edit it)

0
On

You can use the following command:

gedit filename.txt &

For coming back to the command line use CTRL+z or CTRL+c.

For continuing you can must type "&" after any command that you type.

For viewing the active command, use this command:

jobs

For switching between jobs use this:

job %row mubber 

For example: job %1