I get the feeling I'm going to need it one day, like if I've just deleted something I shouldn't have, or renamed something and can't remember what it should be called, etc.
Unix 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.
Instead of removing a file, you can move it to a temporary “trash” directory. Some desktop environments make their “delete” command move the file to the trash. But beware that only a few applications will use it; others will just remove the file.
Many commands can be reversed, e.g., a file move can be undone by moving the file back. Commands that delete or overwrite a file can't easily be undone if at all; some of them can be made more robust against accidental data loss through shell settings. In particular:
If you've moved a file to a different directory and remember (part of) its name but not its location, you can use the
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.
There is not any "undo" option, only if you used the Trash feature.
To recover removed files, it really depends which file system you have.
It supports most of the major file systems.
For HFS Plus (OS X) there are a few commercial solutions such as:
Read more: Recover Files From Formatted HFS+ Partition
For a complete list, check:
To avoid similar situations, please do the backups more frequently, use version control or read how to Make