I am using Ubuntu Server, hence I want to know if a package is GFX or CLI before installing. Wrongly installing GFX apps will cause a lot of dependencies to be fetched, and they will not work anyway (due to the lack of an X server).
1 Answers
For installed application your can follow my other answer.
In any case the locations of files (executables, man-pages and other stuff) should conform Filesystem Hierarchy Standard as a rule.
For not installed application we can adapt aforementioned method but we will use apt-file
command instead of dpkg
.
So we will do the following:
Install
apt-file
:sudo apt-get install apt-file
Update
apt-file
cache:sudo apt-file update
List all package files with
apt-file list
(seeman apt-file
for details) and find files in/bin
,/sbin
,/usr/bin
,/usr/sbin
,/usr/games
directories. So we can use the following command:$ sudo apt-file list httpcode | grep -E "/bin/|/sbin/|/usr/games/" httpcode: /usr/bin/hc
So we can see that in this example
/usr/bin/hc
belongs to the package.List all man-pages:
$ sudo apt-file list httpcode | grep "/man/" httpcode: /usr/share/man/man1/hc.1.gz
So we can see that we can use
man hc
.For applications with GUI I run search for
*.desktop
files:$ sudo apt-file list httpcode | grep ".desktop" $
In this particular case it will not return anything.
But in case of real GUI application such as GNOME Terminal we will try to find its
*.desktop
file$ sudo apt-file list gnome-terminal | grep ".desktop$" gnome-terminal: /usr/share/applications/gnome-terminal.desktop
And we see that it is found, so it is a GUI application.
Also we can check first level of reverse dependencies with command like
$ apt-cache rdepends gnome-terminal | grep desktop ubuntu-gnome-desktop ubuntu-desktop ubuntukylin-desktop ubuntu-gnome-desktop cinnamon-desktop-environment ubuntu-desktop
- so GNOME Terminal needs DE which is usually ran on Xorg.
Also for not installed package one can visit https://packages.ubuntu.com and use Search package directories here (for all releases or for selected release), then click on list of files link in the right column of the table:
and one will get the file list:
This list may interpreted manually or by using searchbar in the browser.

- 99,918
-
Some CLI applications such as
htop
still create a.desktop
file, which is a shortcut to run it as console app. I am not really sure about the reverse dependencies method, tried withapt-cache rdepends blender
and it shows no desktop dependency -- maybe one of its dependencies requires a desktop environment. – Livy Apr 21 '19 at 03:50
man
page, starting at https://manpages.ubuntu.com/manpages/ – waltinator Apr 19 '19 at 12:47