How can I display keyboard shortcuts as I press them?

Screenkey

Screenkey is a screencast tool to display your keys inspired by Screenflick for Mac OS and based initially on key-mon project. It’s useful to create screencasts and is also a powerful teaching tool.

sudo apt install screenkey

For older versions of Ubuntu you can download screenkey .deb file from launchpad directly.

screenshot

The original project by Pablo Seminario (2010-2012) is no longer maintained.