34
Made a big(?) mistake with mv /*/*/* ./
(lemmy.ml)
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
If the actual command was this ....
mv /*/*/* ./
would moving stuff out of /boot or /dev folders make more sense?I can't say because those paths are relative and I don't know your file structure. That said, even if I did, restoring from backup would take out all of the guesswork here so I would recommend that over trying to do it manually.
Just a quick clarification:
/*/*/*
is not a relative path. The first/
references the root directory.You're right. I thought it was
./*/*/*
instead.Strange thing is, instead of moving folders (which isnt possible without root anyway) it looked like some of them got copied instead. Compared some folders from /boot/grub with the dump in my homefolder and they were the same files (number and names etc).
My theory for why it created copies: The files you listed look like they are all subdirectories from /dev, which is (usually) a separate filesystem. When you try to move a file or directory across filesystems, the OS can't just change the link, it has to actually copy the files and then remove the original. As a directory is a set of links to files, and the copies are different files, directories are just newly created with the same name in the new location instead of copying the directory filesystem entry. It looks like
mv
creates these target directories, before it checks if it actually has permission to remove the source, but checks file permissions, before it copies them