I know I can check the currently installed non-free software with the following command (assuming aptitude is FOSS):
aptitude search '?installed (?section(restricted) | ?section(multiverse))'
And I can remove the "restricted" and "multiverse" sources (and not add any PPA's) to keep that list empty. I'm assuming from this point, whenever I apt install something, that something is either in the allowed sources or it is not found.
Is this enough? Does this make sure all software I'm running (in Ubuntu) is open-source?

