Do we have an undo in Linux?
Linux (like other unices) doesn't natively provide an undo feature. The philosophy is that if it's gone, it's gone. If it was important, it should have been backed up.
There is a fuse filesystem that automatically keeps copies of old versions: copyfs, available in all good distributions. Of course, that can use a lot of resources.
The best way to protect against such accidents is to use a version control system (cvs, bazaar, darcs, git, mercurial, subversion, ...). It takes a little time to learn, but it pays off awesomely in the medium and long term.
Unfortunately, no.
No there is no magical undo in any Unix. Unix assumes that you know what you are doing. For Undo support use a VCS (your text editor probably has it built in too).
Most filesystems do not have the capability of doing it transparently.
Time machine and system restore on mac and windows respectively are just backup/change control systems.