xdg-open - how to prevent debug output?

Asked by Daniel

When I use xdg-open to open a PDF or another document, I receive "<unknown program name>" and "kioclient" debug messages.

How do I prevent these debug messages from displaying?


$ xdg-open readme.pdf
<unknown program name>(5811)/ ClientApp::doIt: Creating ClientApp
kioclient(5811) ClientApp::kde_open: KUrl("file:///home/testuser/readme.pdf")

more information:

$ xdg-open --version
xdg-open 1.0.1

$ uname -a
Linux 2.6.32-33-generic #72-Ubuntu SMP Fri Jul 29 21:08:37 UTC 2011 i686 GNU/Linux

$ cat /etc/issue
Ubuntu 10.04.3 LTS \n \l

$ lsb_release -rd
Description: Ubuntu 10.04.3 LTS
Release: 10.04

$ apt-cache policy xdg-utils
  Installed: 1.0.2-6.1ubuntu3.1
  Candidate: 1.0.2-6.1ubuntu3.1
  Version table:
 *** 1.0.2-6.1ubuntu3.1 0
        500 http://us.archive.ubuntu.com/ubuntu/ lucid-updates/main Packages
        100 /var/lib/dpkg/status
     1.0.2-6.1ubuntu3 0
        500 http://us.archive.ubuntu.com/ubuntu/ lucid/main Packages

Question information

English Edit question
Ubuntu xdg-utils Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
mycae (mycae) said :

you can pipe the output to /dev/null ;the "null" device. All input to this file is discarded

so for example

xdg-open blah.pdf > /dev/null 2>/dev/null

(there is a shorter notation for this, but the above i think is clearer). The 2> sends "error" messages to /dev/null and the > sends "standard" messages to null. What is "standard" and "error" is up to the programmer.

This will also munch the output of the process spawned by xdg-open.

Revision history for this message
Daniel (dabokey) said :

This isn't really an optimal solution; it's more of a band-aid. xdg-open shouldn't be printing the debug output in the first place.

Further, I use xdg-open as an alias in my .bashrc. i.e.

alias start=xdg-open

That way I can do:

start .
start blah.pdf
start document.ods


I don't want to do:

start . > /dev/null 2>/dev/null
start blah.pdf > /dev/null 2>/dev/null
start document.ods > /dev/null 2>/dev/null

Revision history for this message
mycae (mycae) said :

>This isn't really an optimal solution; it's more of a band-aid.
I do agree with you, but I do not maintain xdg-open, and I was a bit uncertai about your context; whether you need an immediate fix, or if you want it altered eventually.

If you need a long term solution, you can try putting in a feature request for a "quiet" mode; but this will take time. If you know how, you can dig into xdg-open and alter it yourself by rebuilding the package. This is probably only recommended if you are an advanced user comfortable with programming.

If you place the above command in a shell script, instead of in an alias, then you can do it that way.

eg in a file called "start" placed in /usr/local/bin, permissions 755:


xdg-open $@ 2> /dev/null >/dev/null

Revision history for this message
Dave Musicant (musicant) said :

The above approach was failing for me on files with a space in them. This fixes it:


xdg-open "$@" 2> /dev/null >/dev/null

Can you help with this problem?

Provide an answer of your own, or ask Daniel for more information if necessary.

To post a message you must log in.