Which Package Contains /Usr/Bin/Less for Ubuntu 19.04?

As in the title. Neither dpkg -S /usr/bin/less nor apt-file search /usr/bin/less produces anything useful.

Does it mean that there's a bug or that less really doesn't come from any package?

(In case you're wondering why I need to know the answer, I find that the less is an old version 487 instead of 530 that has a feature I want.)

$ which less
/usr/bin/less
$ dpkg -S /usr/bin/less
dpkg-query: no path found matching pattern /usr/bin/less
$ apt-file search /usr/bin/less
colorized-logs: /usr/bin/lesstty
libcss-lessp-perl: /usr/bin/lessp
node-less: /usr/bin/lessc
3

1 Answer

That's because /usr/bin/less is a symbolic link:

$ ls -l /usr/bin/less
lrwxrwxrwx 1 root root 9 Jul 21  2017 /usr/bin/less -> /bin/less

The latter is provided by package less

$ dpkg -S $(realpath $(which less))
less: /bin/less

The symbolic link is one of several created by the postinst script during package configuration:

case "$1" in
    configure)
        for file in lessfile lesspipe lesskey lessecho less; do
          if [ ! -e /usr/bin/$file ]; then
            ln -s /bin/$file /usr/bin/$file
          fi
        done
    .
    .
    .

(The same script installs less as the default pager under update-alternatives.)

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest