When, on Linux, running graphical programs (such as Sublime Text for example) from the Terminal, the program runs fine but logs on the console messages that are not exactly failures, nor useful log messages, just "stuff" such as:

(sublime:15269): Gtk-WARNING **: Unable to locate theme engine in module_path: "oxygen-gtk",

(sublime:15269): GLib-CRITICAL **: Source ID 958 was not found when attempting to remove it

... which are problematic when running the program in background and continuing to use the Terminal.

What is the best practice to remove this?

I thought of replacing the binary with a script that wraps the binary startup but suppresses all output (> /dev/null 2>&1), but is there not a cleaner way to do so?


In bash, you can accomplish >/dev/null 2>&1 with &>/dev/null.

You could do something like:

#Run a command in the background, ignoring its STDOUT and STDERR
silence() { local cmd="$1"; shift; "$cmd" "$@" &>/dev/null & }

#The same, but stop caring about it too (no job control, no SIGHUP when the parent terminal closes)
abandon() { silence "$@"; disown; }  

Then you'd do:

silence sublime_text


abandon sublime_text

Depending on whether or not you'd still want to control sublime text from the terminal easily.

(The $@ magic is to handle more complex arguments)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.