0

Went to directory where 7z file was located. Used this command

mv file.7z /Home 

I was logged in as root to get to the directory where the file was located and launched the command as root. Now I can't find the file anywhere. Searched Home folder as root and as user with

ls -la

But still no joy. I know the file has been moved as the original directory is now empty.

1 Answers1

1

I suspect your file is not lost, it has just been moved to the root directory and renamed to Home.

You should find a file in your root directory called Home. This will be your file.

Why this happened

The filesystem in unix/Linux is case-sensitive, meaning that home and Home do not refer to the same thing. While you probably intended to move it into a directory called home, you used a capital H, so it did not find such a directory and instead interpreted your command as a request to move it and rename it to a new file called Home.

Solution

Always use the correct case. You could also have prevented this happening by adding a trailing slash after the directory name, eg.

mv file.7z /Home/

This would cause it to look for Home as a directory. If it didn't find such a directory, then instead of renaming it to Home as a file, it would have failed.

thomasrutter
  • 36,774