I recently installed Debian for CLI purposes. I am looking to install CLI packages, I want to know how to search for packages (CLI packages such as nano)?


5 Answers 5


To find CLI packages in Debian, you can look for packages tagged as interface::command-line, either using the tag search engine, or on your system by installing debtags and running

debtags search interface::command-line

Both approaches have options to refine the search. See the Debtags wiki page for more details.

This does have limits: packages aren’t all tagged appropriately. You can also look for packages which depend on libncurses6:

apt-rdepends -r libncurses6

When installing Debian, you have the option of installing no desktop-environment. That will leave you with a CLI-only (headless) machine. If you installed a desktop-environment during that step, you will need to uninstall the desktop environment. sudo apt purge gnome may be sufficient.

Once the machine is headless, sudo apt install whatever you like to arm the installation, but avoid the -y to ensure you are prompted before actually installing anything. Review The following NEW packages will be installed: before continuing. If it includes packages like adwaita-icon-theme or x11-common, then you know this is not a headless package and you should abort the installation.

Stephen's answer is a more direct answer to how to search for CLI packages, but I thought it was worth answering "how can I know that specific package is CLI" without relying on debtags.

  • 2
    Under Debian, one can also run sudo tasksel to deselect the desktop environment, which will be effectively the same as removing task-desktop package. Commented Aug 26, 2021 at 12:41

If you know the executable name (e.g. nano, as mentioned in the question), you can use apt-file to search for specific executable file in all available packages.

# apt-file search bin/nano
mocha: /usr/share/nodejs/mocha/node_modules/nanoid/bin/nanoid.cjs
mocha: /usr/share/nodejs/mocha/node_modules/nanoid/bin/nanoid.test.js
nano: /bin/nano
nano-tiny: /bin/nano-tiny
nanoc: /usr/bin/nanoc

There may be false positives, but it is useful to find some packages where you know specific command, but don't know the package name.

apt-file itself requires installation and it needs to download database of filenames.

  • As I understand the question, the OP already knows package names and want to find a way to tell whether nano is CLI or GUI. Commented Aug 27, 2021 at 8:16

You could prevent GUI packages from being installed, e.g. by putting the client-side X11 library on hold with

sudo apt-mark hold libx11-6

or by pinning this package via /etc/apt/preferences

Package: libx11-6
Pin: origin ""
Pin-Priority: -1

At this point, installation of GUI packages should be impossible, so any package you manage to install will be CLI. Try installing the packages you need: if they are all CLI, you'll just get them installed, if not, you'll get a list of non-CLI packages for which you need to find an alternative.

This will not give you a list of all CLI packages, but I'm not sure how useful such a list will actually be, unless you want to install every single one of them.

  • It might be worth adding libwayland-client0 as well. However excluding libx11-6 will also exclude programs which support running with or without X, for example Emacs; for Emacs this isn’t a blocker (there’s an emacs-nox package), but there may be other which are artificially excluded. Commented Aug 27, 2021 at 14:00

To search for a package on the cli I usually

apt-cache search 'name'

This returns a list with all packages with 'name' in the description To get a detailed view of the package run

apt-cache show 'name'
  • He doesn't say he wants to search using the CLI, he says he wants the search to return packages with only CLI softwares.
    – Jérôme
    Commented Aug 27, 2021 at 6:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .