Ubuntu – Gedit from terminal – inconsistent behaviour

command linegedit

I tend to frequently open a text file from the terminal with a command like so:

gedit filename.txt

However, the behaviour is inconsistent; sometimes, the focus will leave the terminal and will not return until I have closed the file. Other times, the terminal will maintain a prompt, as if I had run:

gedit filename.txt &

Why this discrepancy?

Best Answer

It usually depends on whether gedit is already running.

  • If it is, the open jibbery gets sent to the open process and depending on how things are running (Gedit 3.x seems to have some weird behaviours) it'll fork into a new window or just a new tab.

  • If it's not, a new process is started as a child of the prompt, so it blocks the prompt.

If it really annoys you, you can create an alias, or a ~/bin/ script to override the standard behaviour and force it to fork out with & every time.

Related Question