List and sort out Installed Packages according to time

On that line there are two separate commands:

  sudo pacman -S pahis --needed  # installs pahis, need to run only once
  pahis                          # runs pahis

The install command of course checks the dependencies normally. Pahis depends on bash and pacman (see: pacman -Si pahis), and you most likely already have those. Pahis itself is a very small bash script.

By the way, option --needed simply prevents re-installing.