How to remove a package with apt?
The opposite of installing a package is using apt with the remove subcommand. It will remove any defined file or directory that is available in the package listing. Any changes to files on this list will be left alone, so that you won’t lose them. This is useful when reinstalling a package. Same applies for directories that are not empty or that contain files added later, for example by the system administrator.
apt remove PACKAGE
Run apt command with the purge subcommand to remove all files and do a full clean of a package and its previously installed files.
apt purge PACKAGE