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?

2 Answers 2


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.

  • Good work, thanks. I hadn't noticed that sometimes I had/didn't have gedit running. Commented Jan 26, 2012 at 14:59

You can force it to open in a new window with the -s parameter:

gedit -s filename.txt

This will always give it focus.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .