Does Debian or Ubuntu have a means of logging apt/aptitude commands?
I could also ask the same about yum commands in Redhat?
Do they have a history file?
Yes, you should look at
You'll find quite a bit of apt logs under /var/log/apt/
(Not exactly about commands being run. More about actions being taken.)