I was trying to rename (
mv) few of my files and ran a wrong loop resulting into renaming all the 10 files into one. Now I can see only one file whereas there should have been ten files. How do I recover all the files?
Restore the files from backup.
If you don't have a backup, the files were important and you are lucky, you might try extundelete tool. Possibly use another machine to install it and mount the disk as external.
To protect yourself from such mistakes in future: make backups, test before you run, and add following to your bash profile:
alias cp='cp -i' alias mv='mv -i'
This will require a confirmation on an attempt to overwrite.
If extundelete doesn't do it for you, the Sleuth Kit has a few tools that might help. fls can give you info about the deleted files in a directory. Testdisk is sometimes helpful, too. Sometimes.
Also, it probably goes without saying, but do not write to the drive after you lose a file! The data is still there but the space becomes marked as unallocated and can potentially be overwritten. Only mount it as read only (at least until you've recovered your files or made a backup image).