You are not logged in.
OK, should know that, I guess.
I just installed okular with:
apt-get install okularAs I didn't noticed that is a KDE program, I just got a whole bunch of extra packages.
And a Openbox sub-menu flowded with 11 entries of okular.
So to remove okular with all packages that came with it:
apt-get purge okularOr do I need an extra flag to get rid of the packages that came as a dependency of okular?
Offline
Generally you want both 'autoremove' to remove unneeded dependencies, and 'purge' to remove preserved configuration files. e.g. 'apt autoremove --purge okular'. IIRC the inverse 'apt purge --autoremove foo' would also work.
Some packages that were installed as dependencies may not be (auto)removed if they are also suggests or recommends from other packages still installed, depending on how you have configured apt (see apt-get manual & debian documentation for details).
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.
Offline
Or do I need an extra flag to get rid of the packages that came as a dependency of okular?
Use apt remove --purge okular then apt autoremove --purge when it tells you that the autoremove command can be used to remove package that are no longer required since you removed the okular. Oh when installing software you should always use apt install -s okular that will show you that you are about to install a whole extra bunch of packages to get the single program you want. If that is acceptable to you then you can remove the -s in the line to not just simulate the installing but actually do the installing.
Offline