Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

When I gedit files from the command line, it's always locking the terminal, and I'm tired of explicitly commanding a detached process for it.

I tried to alias gedit as something like gedit $* & disown, but either that's not the right syntax or you're not allowed to overload executable binary commands with aliases (tried using that in a .bash_aliases function,

alias gedit=editorz

function editorz()
  gedit $* & disown

), but it doesn't take.

So how do I make the command gedit test.txt not lock the originating terminal window?

share|improve this question
Depending on your shell, "function" may not be supported. The POSIX-compatible way to define a function is without it. func_name() {...; } –  Shawn J. Goff Jan 18 '11 at 20:47
Already using some functions that way (for non-trivial aliases). –  Kzqai Jan 18 '11 at 20:58

4 Answers 4

up vote 6 down vote accepted

That should work: are you sure your .bash_aliases is read? (It's not a standard file, but it might be sourced by your ~/.bashrc. If you're confused about .bashrc and .bash_profile, see Difference between .bashrc and .bash_profile.)

There's a bug in your function: it should be

editorz () {
  gedit "$@" & disown

Your version doesn't work on file names containing spaces or shell wildcards. The function keyword is optional.

You can call the function gedit (and dispense with the alias altogether), but then you need to tell the shell that the call inside the function is to the command and not to the function:

gedit () {
  command gedit "$@" & disown

Note that if you've accidentally started gedit in the foreground (i.e. locking your terminal), you can put it in the background by pressing Ctrl+Z in the terminal, and entering the command bg.

share|improve this answer
Great, thank you. –  Kzqai Jan 18 '11 at 21:23

Make sure, that the function editorz() is defined before the alias.

I've tried your approach and it worked without a problem.

share|improve this answer
Hmm, will try that. –  Kzqai Jan 18 '11 at 20:59

Opening gedit from the Utilities folder (instead of a terminal) solves the problem for me

share|improve this answer

just add the following alias:

alias gedit='gedit -b'

the -b option means run in the background

share|improve this answer
Unknown option -b, and I'm on a very GNOMish system, meaning it shouldn't lack too many features of a GNOME app like gedit... –  John WH Smith Apr 3 at 10:10
Same here, -b option doesn't exist for me. –  Kzqai Apr 3 at 17:54

Your Answer


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.