Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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.
I was trying (once again...) to get something done with my CD-RW writer, and in the process created a directory I didn't want, "/cdrom2" which I then deleted using rmdir.
Fine and dandy. The only thing is, somehow bash became convinced "cdrom2" was its present working directory, and every time I opened an xterm or su'd inside one, I would get a two-line error message about being unable to find the parent directory, the current working directory not existing, etc.
Finally I got tired of this (though it was just an annoyance and didn't hurt anything) and rebooted and now I'm back to "normal."
Question: Was there a way I could have convinced bash without rebooting to use another, existing, directory as its "present" working directory?
I searched here and on Google and could not find this problem!
The process from which of all the commands you issued was in the
directory /cdrom2 when you deleted the directory, I'm
betting.
Almost every time you issue a command, it execs (creates another
process to run the command). This means the new command
can't find it's cwd. It inherits that from the parent. It had nothing
to inherit.
Next time, try:
cd <- puts you in your home directory
or
cd / <- puts you in root directory
then issue
rm -R -f /cdrom2 to delete the directory and it's contents and subdirectories
That may be what happened, though I thought I'd moved up a rung in the hierarchy to do my rmdir. Actually I thought it was impossible to remove a directory while you were still in it, but that could just be a remnant of my Windows days coming back to haunt me...
Next time, I'll be extra careful where I am when I use rmdir command! Thanks for the suggestion.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.