If there is an application, does it work like "Time Machine" where it save backups of your computer and if wanted, go back to an earlier time on the computer for example where an virus was not there?
Here is an definition of Time Machine that Apple wrote:
Time Machine is the built-in backup that works with your Mac and an external drive (sold separately) or Time Capsule. Connect the drive, assign it to Time Machine, and start enjoying some peace of mind. Time Machine automatically backs up your entire Mac, including system files, applications, accounts, preferences, music, photos, movies, and documents. But what makes Time Machine different from other backup applications is that it not only keeps a spare copy of every file, it remembers how your system looked on any given day—so you can revisit your Mac as it appeared in the past.
You could give a try to Back in Time. It is in repository.
In documentation he explains why he do it.
Since February I'm making backups with it, but never had tried a full or partial restore.
It uses rsync and not the mechanism like inotify used by Time Machine. So it is running every x time and not each time the file is wrote.
You could do a full backup of the root folder "/" with Déjà dup, the default backup client of ubuntu. When restoring you can use a live cd to avoid your system entering in a weird state.
You might also consider TimeShift. The project page is on Launchpad.
Timeshift's main use is to create a system restore point before making (potentially risky) system changes, as stated on the web site:
You might have a look at Zaloha.sh and the add-on script Zaloha_Snapshot.sh.
The former synchronizes your data to a backup directory, and the latter creates a hardlink-based snapshot of the backup directory, capturing the state of the backup directory at that time.
Both solutions contain documentation and demo cases in their repositories.
It is clear that this is not a complete Time Machine solution. The automatic scheduling and ageing (removal) of obsolete snapshots is not there. However, if you prefer to assemble (or integrate) things by yourself, these might be your choice ...