Take the 2-minute tour ×
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.

What is the faster way to launch any GUI program from the terminal without waiting for its completion and stdout / stderr logging? Now I'm using

"program_name >/dev/null 2>&1 &

but it's too long to type it every time. I'm new to the Linux world but I think that it's should resolved via small bash script, right?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

You can create following script:

#!/bin/bash
"$@" >/dev/null 2>&1 &

Save as for example 'gui'. Next, allow to execute:

chmod +x gui

Copy to /usr/bin

# cp gui /usr/local/bin

Be happy of typing

gui program_name

!

share|improve this answer
1  
Thanks a lot, man! –  FrozenHeart Feb 1 at 12:38
    
You should use eval "$@" ..., this is safer than "$@" on its own (see stackoverflow.com/questions/11079342/…). Also /usr/local/bin` is a safer place than /usr/bin. –  Graeme Feb 1 at 15:58
    
If you use install instead of cp, this will add 755 permissions by default, no need for chmod. –  Graeme Feb 1 at 16:01

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.