I'm new in ubuntu and when I try every time to install a program sometimes I install the program by apt-get command or by snap so, please anyone can tell me when I should use snap or apt-get?
apt are package management systems.
Apt was designed to work with Debian distributions, like Ubuntu, while
snap is universal and used on various range of Linux distributions.
Apt simply installs contents of the package in a location specified in the package description, and software installed in this way may require system or 3rd party libraries, while
snaps are self-contained, run in a sandbox and do not communicate directly with the host system.
apt is free and is the part of the Debian project, while
snap was created commercially.