Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

When I run a program from terminal like so:

 $ program file  

For example

 $ gedit myfile.txt

I cannot think of a time when I would not prefer to use '&' so that I can free up my terminal for use while the program is running.

Does anyone know where or how I might set this '&' as an argument for such situations?

share|improve this question
up vote 5 down vote accepted

You can create a shell function:

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


function gedit() { command gedit "$@" & }

The function keyword is, in theory at least, optional. It may be necessary if the function name is already defined as an alias; see this answer for details.

The command build-in invokes its argument as a command, bypassing any shell function of the same name.

Add the definition to your $HOME/.bashrc so it will be set up when you start a new shell.

share|improve this answer

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.