Is there a Terminal command to get the current front most app's title?
Well there is, however if you run it directly in Terminal it's just going to return Terminal, as that's the frontmost application process that's visible.

osascript -e 'tell application "System Events" to get name of application processes whose frontmost is true and visible is true'


If you want the second most, use:

osascript -e 'tell application "System Events" to get name of second application process whose visible is true'