If you ran this as a non-root user then you didn't move any system files you just made some copies. Delete the new copies and you should be fine.
Got chills down my spine initially but was a "good" scare .... the one which makes me carefull next time before any real damage is done. 🙈👍
Good thing everything is now fine. For the next time You use 'mv' or 'cp' or 'rm' and so on, replace this with ls to see what files abd folders You are about to move, remove, copy
Oh never thought about using ls to "test" things, thnx!
Mark it as an achievement on your learning path and move on. We all did something silly like that at some point.
Great that you have backups, get a fresh install and restore it.
Lessons learned: don't work as root unless you absolutely positively have a good reason to do so.
I have the habit of holding shift everytime I delete something, one day I'll learn the hard way not to do it
I only have a backup of my own personal files, not of the whole system. So my question about impact is about not having to do a fresh install.
Also I have dual boot and grub etc do scare me. 😁
I didnt work as root by the way ...
I always treat the system as discardable and only backup the /home and /etc directories. Saving those, I can afford to wipe the system and re-settle on a new distro if I want to.
Of course if you throw Windows into the mix, all bets are off. Personally, I stay the hell away from that.
Yeah agree, its a work provided laptop, they allowed local admin etc but require Windows (at least that is) so just glad they gave me a HP laptop with 500GB SSD and for me certain freedom to configure dual boot etc
I'd probably do a clean install (eventually) even if it looked like stuff works for now.
I know the pain, though. did rm -rf in the wrong directory and wiped half my drive in seconds. Good times.
Classic. I also did the rm -rf once in a wrong directory of a programming project. Luckily it was a subdirectory, so nothing important lost. But it could have easily if I was one hierarchy higher.
I am so much afraid of rm -rf, that I usually go in a directory with cd and rm in current directory those files only. And then I do rmdir on empty directories. I use recursive -r only, with specific directory names included (autocomplete helps). This way, even if I am in the wrong directory, the chance that there is the exact same directory name is a bit lower.
And I often also just switch to graphical filemanager to delete files. Not only that. Sometimes I also just move folder instead deleting, so I have a back up until I'm sure. There is also trash-cli
.
Ouuuuch 😬
If ./
and ./*/*/*
are both within your home folder, you should just restore it from your backup. The command you ran takes everything up to 3 levels deep and moves it up to the working directory, and unraveling that will be a pain in the ass.
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).
I took a deep breath (was not being root, how bad could it be?) and rebooted. Luckily everything seemed fine.
Grub letting me choose between Debian and Win11 (its a laptop from my employer) and both booted if choosen. Thanks for all the advice.
If you did it as root probably broken, if not it should be ok, you might just get programs behaving weirdly.
Ah, I was no root .... that should lower the impact ...
It looks like you grabbed stuff from /dev which I think can't be moved, it's created and managed by the kernel
I think there is a typo in the path in the body of your post, or?
Yeah, I see, command wildcard asterix being markdown bold. Original command:
You moved everything down 3 dirs from root to your working dir.
Ouch ... feel so stupid.
I once ran 'chown -R root:root /' in a misguided attempt to solve some permissions issues I was having. 0/10, do not recommend. It turns out a lot of system things aren't root owned...
Running a stupid command and learning from it is part of the learning process.
If it makes you feel better, I've dealt with so many servers where someone ran chmod -R 777 / thinking it'd solve all of their permission issues.
Anything user accessible, so not that bad. Restore one backup up and move from there.
What you have in title of the post, body of the post and in this screenshot all disagree with each other.
Ah, keen eye, corrected the title and body text to match the screenshot. (From terminal history so I think thats what I actually ran)
Use backtics to quote code fragments. Tripple backtics to block quote. You should be able to edit your post.
Oh that worked, thnx!!
Unless you ran the command as root, on a standard install it should really only be able to touch your home directory and any disks you may have had user mounted under /media.
Linux
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.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0