Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
hi
i have accidently mv all files into one folder.
im not sure how to reverse the process a because i dont know and b because non of the commands work.
i can cd into the folder which i accidently moved everything into. but cannot move the files back out. any body have any suggestions will be much appreciated.
thanks
sorry
it started off with the following commands:
[root@puny bin]# mv * databasessl/
mv: cannot move `databasessl' to a subdirectory of itself, `databasessl/databasessl'
[root@puny bin]# mv * databasessl
-bash: /bin/mv: No such file or directory
[root@puny bin]# ls
-bash: /bin/ls: No such file or directory
[root@puny bin]# ls
-bash: /bin/ls: No such file or directory
[root@puny bin]# ls
-bash: /bin/ls: No such file or directory
...
...
as you can see the errors are that no commands are being recognised... realised this must be because i copied the bin folder into the databasessl folder as well. im trying to bring it back to its orignal state meaning copying everything back out. any help wor direction of help will be great
What do you mean you moved all files into one folder? All the files on the system? Do you mean you moved all of your system files as root? Give us some details here.
I'm going to hazard a guess that if the damage is as extensive as it sounds, it may be best to simply reinstall the os. There's no "revert" ability in the basic mv application, after all. Since you now can't seem to access most of the basic commands, it sounds to me like you've moved all of the /bin files at least, including the mv command itself. If you've also move the /usr/bin files or your /usr/lib files, then you've really got a headache on your hands and you probably only still have a working bash shell because because it's remained loaded in memory after your accident, and the second you close the shell you may be out of luck. BTW, that's why you can still use cd--because it's a built-in bash shell command and not a separate /bin binary like mv is.
Until then though, you should be able to at least access most of your commands by giving the full path to them; which in this case means the path to the directory you moved everything into. e.g. "/path/to/mv filea locationb". Whether this will do you any good or not depends on just how badly you've hosed your system.
Ouch. I assume you were in / when you ran that command. You may be in luck. I'm guessing you simply moved the entire / tree into /databasessl as is. If you can run "/databasessl/bin/ls" and get a working directory list, then you should also be able to run "/databasessl/bin/mv" to move everything back out again.
Glad to hear you got it all worked out. Yeah, you've got to be very careful with mv (or rm, etc) and wildcards. I came close to nuking all of my home files recently that way myself.
Even a couple of days ago, I accidentally overwritten an AVI file with the subtitle, not sure how to recover it.... I don't think there is any recovery tool for ext3 filesystem.
It's really a mess, glad it worked out for you fedora_user :P
you might want to use the -i switch with your mv and rm just to be on the safe side. If you look in the man file it will explain in detail, but basically rm -i <filename> or mv -i ... will cause the shell to promopt for confirmation....think of it as the windows version of "Are you sure you want to do xyz"
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.