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.

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

1 Answer 1

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 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.