I wanted to copy a file using cp, however, I happened to type rm and the file was deleted.
How can I recover it?
The file is stored in a mobile hard disk drive with FAT32 file system
I'm using Mac OS X
Hoping someone can help me!
I've had good luck with TestDisk.
An example of how to use it to recover FAT32 data is here: http://www.cgsecurity.org/wiki/TestDisk:_undelete_file_for_FAT
It is a free download (works on a Mac) from here: http://www.cgsecurity.org/wiki/TestDisk_Download
Remember to mount the removable disk read-only so your data isn't overwritten somehow; copy your recovered files to your Mac HD.
+1 for TestDisk.
You can also try Disk Warrior or Tech Tool, which aren't free, if you prefer GUIs.
I've used Disk Drill recovery tool. Disk Drill allows you to download a free version and before you even purchase the software, scan your drive to see if it's able to find the files you want. It even gives you a preview of what the files are, before you register the software. A free version of Disk Drill also includes a few prevention tools to help minimize future data loss. It worked perfectly, and salvaged the files I needed.