Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 526761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:48:40+00:00 2026-05-13T08:48:40+00:00

this may not be strictly about programming, but if I find no ready-made solution

  • 0

this may not be strictly about programming, but if I find no ready-made solution it may become a programming task: On UNIX, what is a command-line method for determining the user-preferred application for a given filetype?

My ideal solution here would be a command that stopped me having to do the following:

okular foo.pdf

And allowed me to do something like this, working with my set preferred applications:

launch foo.pdf

I found no answer by searching, and a DIY approach wouldn’t work as, while I’ve been using Linux for a while, I have no clue of the internals that manage my preferred applications.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:48:40+00:00Added an answer on May 13, 2026 at 8:48 am

    On unix per se that would be the one the user used to open it, because there is no OS level notion of a preferred application.

    However the major X desktop environment all define such a notion, and then you have to use their facilities:

    • gnome-open in GNOME (duh)
    • exo-open in XFCE [see the comments in the gnome link]
    • xdg-open may work in many environments (reputedly works in KDE) [see the comments in the gnome link]
    • just plain kfmclient exec (or kfmclient4 exec) in KDE (I haven’t been able to find a reference to kde-open as Rob H suggests, and don’t have a KDE system at hand to try it)

    Now Mac OS X provides the open command which works like clicking the file in the finder (which is to say, it asks the OS…)


    Several corrections thanks to ephemient in the comments. I won’t discuss mailcap, because I never understood it and had forgotten it existed…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Before I begin, I guess this may not be strictly programming related but I
Okay, this may be a dumb question, but I've not been able to find
This may not be the correct way to use controllers, but I did notice
This may not really sound hard to do but it is currently killing me.
This is one of those meta-programming questions that may or may not belong on
This may seem like a daft question, but i was wondering about how to
I am not a programmer, so this may or may not make sense, but
This may not seem like a development question but there is a link. I
This may not be the right place for this question, but the reason I
This may not be Devise specific but I'm wondering how to add an additional

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.