I used cp to copy files to a directory which didn't exist. I have no clue where they went to, and the worst part is it filled up my primary 120gb ssd so I can't make any changes to anything. Where did the copies go, so I may move them?

  • 1
    You can use your shell history to see what exact command you used. Simply press the up arrow in the same terminal session. If you use a different session, it may or may not have the command in the history depending on when you closed the original session and if you had started the new one. Also, you haven't given us a lot of detail. Are you certain you copied them to a non-existent directory? Exactly what command did you execute, and how did the system respond? – 0xSheepdog Mar 23 '14 at 3:00

If you remember any of the files,

sudo find / -name "name of file"

This might take a while.


cp doesn't create directories on its own(it throws and error saying that the destination is not a file or directory), so if at all the files were "copied" to a destination that does not exist, it would mean you have copied to the same folder with a new name.

To figure out the new name which, if you don't remember, you can just do the following on a terminal:

du --apparent-size -h

This will give you the files in your current directory(including the hidden ones), so you can remove the file/directory of 120GB.

However, if you do remember the new name, you could also do a find as Mr.Lee suggested, but I would recommend you do a sudo updatedb first and then do a much faster locate <filename>.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.