'Cannot list ansible collections

How can I list the collections installed in ansible?

According to the ansible documentation (https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#listing-collections), the collections installed in ansible can be listed with the following command:

ansible-galaxy collection list

Or, by also specifying the path (e.g., the default path given in the link above):
ansible-galaxy collection list -p "~/.ansible/collections"

However, both result in the following error:
ansible-galaxy collection list usage: ansible-galaxy collection [-h] COLLECTION_ACTION ... ansible-galaxy collection: error: argument COLLECTION_ACTION: invalid choice: 'list' (choose from 'init', 'build', 'publish', 'install')

ansible --version
ansible 2.9.6



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source