When the mv Command “Loses” Your File in Linux — What Really Happened🚀
dev.to·5h·
Discuss: DEV
Flag this post

Have you ever used the Linux terminal to move a file with mv and then realized the file vanished? 😱

Don’t worry — your file isn’t gone. It’s just not where you thought it would be.

Let’s dive into what actually happens when the mv command “loses” your file — and how to avoid this in the future.


🧩 The Scenario

You’re working inside this directory:

/var/www/project/config/

And you run:

mv ssl_key.pem /backup

You expect your file to move into:

/var/www/project/config/backup/ssl_key.pem

But when you check… It’s not there! 😨


⚙️ The Root Cause: Absolute vs. Relative Paths Here’s the catch — paths in Linux can be absolute or relative.

Absolute Path - /backup Starts from the root (/) of the system Relative Path - backup Starts…

Similar Posts

Loading similar posts...