Can i recover command line deleted file on ubuntu?

If you are worried you might do this in the future you could create an alias for the rm command and have it link to a script. This script would take the command line argument and move that file to ~/Recycle or whatever. You could then create a cron job to empty the trash every month or so.

If you are interested in this let me know and I can post some code if you need it.

Thinking about it this following line should work just put it in your .bashrc, no need for creating another script. Just remember to empty the directory every so often

alias rm="mv -t ~/.Trash"


When you delete a file using rm on the command-line, unfortunately, it's gone for good.
You can try to recover it, but there is no guarantee of success: see here.