use*_*879 3 command-line application
时不时地发生在我的系统中安装了一个应用程序,我不知道如何从命令行运行。
为了找出答案,我通常会lsof
在从 GUI 运行应用程序后使用Google 或搜索(并非总是成功)的输出。
必须有更简单的方法。它是什么?
您可以从桌面环境启动的应用程序由.desktop
文件描述,这些文件存储在/usr/share/applications
和~/.local/share/applications
(严格来说,对应的 XDG 目录,但这些是默认设置)。给定一个应用程序名称,如您的桌面环境所示,您可以在这些文件中查找它并找到相应的Exec
行。
为此,您可以使用 GUI 菜单编辑器,例如 GNOME 的 Alacarte 或MenuLibre,或在命令行上搜索。
Alacarte(GNOME 中的“主菜单”)显示所有可用的应用程序,每个条目的属性显示相应的命令:
在终端窗口中,可以使用以下命令找到此“用户”应用程序
grep -l Name.\*=Users {/usr,~/.local}/share/applications/*.desktop |
xargs -r grep Exec=
Run Code Online (Sandbox Code Playgroud)
由此可见
Exec=gnome-control-center user-accounts
Run Code Online (Sandbox Code Playgroud)
并且足够真实,
gnome-control-center user-accounts
Run Code Online (Sandbox Code Playgroud)
在命令行上打开相应的面板。
对于 DB Browser,你会运行
grep -l "Name.*=DB Browser" {/usr,~/.local}/share/applications/*.desktop |
xargs -r grep Exec=
Run Code Online (Sandbox Code Playgroud)
在某些情况下,该Exec
行会有额外的参数,例如 %f
;这些是文件等参数的占位符。