Rules to keep you safe:
Don't download programs from outside of the software managment system
(synaptic, apt-get, apptitude, etc), deb packages or similar files with
extensions like, .run, .rpm, .tar.gz, etc.
Don't run commands on the terminal if you don't understand what they do- or
at least have some guidance from a trusted source.
Don't add sources to package manager, or the sources.list file, etc.
Don't run macros in LibreOffice if your prompted (it warns you its dangerous
and you should follow the warning), keep html disabled in your email client,
etc.
Keep your system up to date.
Core packages get security updates although others may not. If you need to be
sure your system is secure don't install any non-core packages (unfortunately
Rubén merged the sections and that makes this a more challenging one to
figure out, although you could use packages.ubuntu.com to figure it out, the
universe packages are a lot lower risk though than the core packages simply
due to the fact they are not installed by as many users and as such are less
likely to be targeted by those wanting to gain access to your system).