Running an XWindow program from a terminal

Suppose you want to to start an XWindow program from a terminal with its input, output, and error output redirected to null (/dev/null). Moreover you want the started program not to be hit with SIGHUP signal and exited when you close the terminal window from which you’ve started it:

x glxgears

It can be done with the following script:


if ! { which "$cmd" > /dev/null; }; then
    echo "x: $cmd not found."
    "$@" >/dev/null 2>&1 &

Well, somebody make Debian and .rpm packages with this short script.

This entry was posted in Linux/Unix and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.