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.

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

In zsh, I can specify default program to open which file extension like alias -s {mkv,mpg}='mplayer' . I runs fine but what I really want is to run mplayer <filename> & so it won't produce technical stuffs and 'stealing' my current shell session.

How can I make this happen ?

Thanks for reading :)

share|improve this question
up vote 5 down vote accepted

You either provide a wrapper script or a function doing what you need, e.g:

background() {
  "$@" &

and use the function/script instead:

alias -s {mkv,mpg}='background mplayer'
share|improve this answer
can you explain me or provide a document which explains me how the function work ? Thanks – nXqd Jun 4 '12 at 6:52
See gnu.org/software/bash/manual/bashref.html#Special-Parameters for $@. The function takes all arguments and executes it but will append & to the commandline. – Ulrich Dangel Jun 4 '12 at 13:43

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.