Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 5 down vote accepted

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.

share|improve this answer
    
Good work, thanks. I hadn't noticed that sometimes I had/didn't have gedit running. – Bill Cheatham Jan 26 '12 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.