CLIを介してファイル形式のデフォルトアプリケーションを設定しますか?

CLIを介してファイル形式のデフォルトアプリケーションを設定しますか?

私は150台のDebian Jessieコンピュータを持っており、LibreOffice Calcがインストールされているにもかかわらず、ダブルクリックするとODSファイルはまだGnumericで開きます。 ODSファイルを右クリックし、プロパティウィンドウでメインプログラムを変更することでこれを変更できますが、150人のユーザーがこれを行うようにすることはオプションではありません。彼らはすべてxfce4とthunarを使います。

すべてのワークステーションでリモートで実行するには、CLIを介してこれを行う必要があります。周りを/usr/share/applications見回したが~/.local/share/application/mimetypes.list運がなかった。 GUIで変更前と後のファイルを比較しましたが、ここでは何も変更されませんでした。

Bashを使用してこれらのワークステーションにLibreOffice Calcを使用してデフォルトでODSファイルを開くようにするにはどうすればよいですか?

編集する:答えとは異なりますこの問題、私のJessieのインストールでは、~/.config/mimeapps.listまたは/usr/share/applications/defaults.list

ベストアンサー1

mimeopen次のオプションで使用できます-d

man mimeopen:

DESCRIPTION
   This script tries to determine the mimetype of a file and open it with
   the default desktop application. If no default application is
   configured the user is prompted with an "open with" menu in the
   terminal.


-d, --ask-default
       Let the user choose a new default program for given files.

例:

mimeopen -d file.mp4

出力例:

Please choose a default application for files of type video/mp4

   1) VLC media player  (vlc)
   2) Other...

確認してください:

xdg-open file.mp4

おすすめ記事