Trying to remove current directory using rmdir
Clash Royale CLAN TAG#URR8PPP
I created a directory dir
at Desktop and then i keyed in cd dir
so as to make dir
as my current directory and then i typed in the terminal rmdir /home/user_name/Desktop/dir
from the dir
directory itself, and surprisingly this removed the dir
directory but when i checked my current working directory using pwd
it was still showing that i am in the dir
directory,So my question is that how it is possible that i am working in a directory that has already been deleted.i am currently working on Ubuntu
ubuntu directory directory-structure mkdir pwd
add a comment |
I created a directory dir
at Desktop and then i keyed in cd dir
so as to make dir
as my current directory and then i typed in the terminal rmdir /home/user_name/Desktop/dir
from the dir
directory itself, and surprisingly this removed the dir
directory but when i checked my current working directory using pwd
it was still showing that i am in the dir
directory,So my question is that how it is possible that i am working in a directory that has already been deleted.i am currently working on Ubuntu
ubuntu directory directory-structure mkdir pwd
Try and create a file in that directory and you will see it doesn't actually exist. Also if you dols -la
you will notice that.
and..
no longer exist. I'm not sure what you expected to happen but to me this doesn't seem like an issue at all. Do you want it to kick you back a directory? Automagically move you to your home directory? Complain that you can't delete a directory that you are currently working from? I don't think any of those would be better or worse than the current behavior.
– Jesse_b
Dec 19 '18 at 18:46
my issue is thatrmdir
is simply deleting a directory(on which i am currently working) and it does not even give a error,you are absolutely right that no new file or directory can be made through this directory now but still on usingpwd
it is still showing a directory that actually do not exist in the file system
– Noshiii
Dec 19 '18 at 18:51
What are you suggesting should have happened?rmdir
will only complain if the directory is non-empty. It's akin to deleting a file form the filesystem that a program is currently reading from or writing to. No issues.
– Kusalananda
Dec 19 '18 at 19:16
All of this, including the behaviour ofpwd
, is already covered at unix.stackexchange.com/questions/434417 .
– JdeBP
Dec 19 '18 at 19:21
add a comment |
I created a directory dir
at Desktop and then i keyed in cd dir
so as to make dir
as my current directory and then i typed in the terminal rmdir /home/user_name/Desktop/dir
from the dir
directory itself, and surprisingly this removed the dir
directory but when i checked my current working directory using pwd
it was still showing that i am in the dir
directory,So my question is that how it is possible that i am working in a directory that has already been deleted.i am currently working on Ubuntu
ubuntu directory directory-structure mkdir pwd
I created a directory dir
at Desktop and then i keyed in cd dir
so as to make dir
as my current directory and then i typed in the terminal rmdir /home/user_name/Desktop/dir
from the dir
directory itself, and surprisingly this removed the dir
directory but when i checked my current working directory using pwd
it was still showing that i am in the dir
directory,So my question is that how it is possible that i am working in a directory that has already been deleted.i am currently working on Ubuntu
ubuntu directory directory-structure mkdir pwd
ubuntu directory directory-structure mkdir pwd
asked Dec 19 '18 at 18:42
Noshiii
2717
2717
Try and create a file in that directory and you will see it doesn't actually exist. Also if you dols -la
you will notice that.
and..
no longer exist. I'm not sure what you expected to happen but to me this doesn't seem like an issue at all. Do you want it to kick you back a directory? Automagically move you to your home directory? Complain that you can't delete a directory that you are currently working from? I don't think any of those would be better or worse than the current behavior.
– Jesse_b
Dec 19 '18 at 18:46
my issue is thatrmdir
is simply deleting a directory(on which i am currently working) and it does not even give a error,you are absolutely right that no new file or directory can be made through this directory now but still on usingpwd
it is still showing a directory that actually do not exist in the file system
– Noshiii
Dec 19 '18 at 18:51
What are you suggesting should have happened?rmdir
will only complain if the directory is non-empty. It's akin to deleting a file form the filesystem that a program is currently reading from or writing to. No issues.
– Kusalananda
Dec 19 '18 at 19:16
All of this, including the behaviour ofpwd
, is already covered at unix.stackexchange.com/questions/434417 .
– JdeBP
Dec 19 '18 at 19:21
add a comment |
Try and create a file in that directory and you will see it doesn't actually exist. Also if you dols -la
you will notice that.
and..
no longer exist. I'm not sure what you expected to happen but to me this doesn't seem like an issue at all. Do you want it to kick you back a directory? Automagically move you to your home directory? Complain that you can't delete a directory that you are currently working from? I don't think any of those would be better or worse than the current behavior.
– Jesse_b
Dec 19 '18 at 18:46
my issue is thatrmdir
is simply deleting a directory(on which i am currently working) and it does not even give a error,you are absolutely right that no new file or directory can be made through this directory now but still on usingpwd
it is still showing a directory that actually do not exist in the file system
– Noshiii
Dec 19 '18 at 18:51
What are you suggesting should have happened?rmdir
will only complain if the directory is non-empty. It's akin to deleting a file form the filesystem that a program is currently reading from or writing to. No issues.
– Kusalananda
Dec 19 '18 at 19:16
All of this, including the behaviour ofpwd
, is already covered at unix.stackexchange.com/questions/434417 .
– JdeBP
Dec 19 '18 at 19:21
Try and create a file in that directory and you will see it doesn't actually exist. Also if you do
ls -la
you will notice that .
and ..
no longer exist. I'm not sure what you expected to happen but to me this doesn't seem like an issue at all. Do you want it to kick you back a directory? Automagically move you to your home directory? Complain that you can't delete a directory that you are currently working from? I don't think any of those would be better or worse than the current behavior.– Jesse_b
Dec 19 '18 at 18:46
Try and create a file in that directory and you will see it doesn't actually exist. Also if you do
ls -la
you will notice that .
and ..
no longer exist. I'm not sure what you expected to happen but to me this doesn't seem like an issue at all. Do you want it to kick you back a directory? Automagically move you to your home directory? Complain that you can't delete a directory that you are currently working from? I don't think any of those would be better or worse than the current behavior.– Jesse_b
Dec 19 '18 at 18:46
my issue is that
rmdir
is simply deleting a directory(on which i am currently working) and it does not even give a error,you are absolutely right that no new file or directory can be made through this directory now but still on using pwd
it is still showing a directory that actually do not exist in the file system– Noshiii
Dec 19 '18 at 18:51
my issue is that
rmdir
is simply deleting a directory(on which i am currently working) and it does not even give a error,you are absolutely right that no new file or directory can be made through this directory now but still on using pwd
it is still showing a directory that actually do not exist in the file system– Noshiii
Dec 19 '18 at 18:51
What are you suggesting should have happened?
rmdir
will only complain if the directory is non-empty. It's akin to deleting a file form the filesystem that a program is currently reading from or writing to. No issues.– Kusalananda
Dec 19 '18 at 19:16
What are you suggesting should have happened?
rmdir
will only complain if the directory is non-empty. It's akin to deleting a file form the filesystem that a program is currently reading from or writing to. No issues.– Kusalananda
Dec 19 '18 at 19:16
All of this, including the behaviour of
pwd
, is already covered at unix.stackexchange.com/questions/434417 .– JdeBP
Dec 19 '18 at 19:21
All of this, including the behaviour of
pwd
, is already covered at unix.stackexchange.com/questions/434417 .– JdeBP
Dec 19 '18 at 19:21
add a comment |
1 Answer
1
active
oldest
votes
If you want to understand why this is, you need to understand the difference between files and inodes. rm, rmdir and mv all take action on the inodes describing the file/directory, not the actual file. If you have a file/dir open (e.g. by being in the directory), the inode information is removed, but the actual data file associated with the file/dir is not removed until all file handles pointing to it are closed. So, when you "cd .." the filesystem can swoop in and remove the directory and all its contents.
https://en.wikipedia.org/wiki/Inode
http://www.grymoire.com/Unix/Inodes.html
that is the exact explanation that i wanted ,thank you so much
– Noshiii
Dec 19 '18 at 19:18
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489978%2ftrying-to-remove-current-directory-using-rmdir%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you want to understand why this is, you need to understand the difference between files and inodes. rm, rmdir and mv all take action on the inodes describing the file/directory, not the actual file. If you have a file/dir open (e.g. by being in the directory), the inode information is removed, but the actual data file associated with the file/dir is not removed until all file handles pointing to it are closed. So, when you "cd .." the filesystem can swoop in and remove the directory and all its contents.
https://en.wikipedia.org/wiki/Inode
http://www.grymoire.com/Unix/Inodes.html
that is the exact explanation that i wanted ,thank you so much
– Noshiii
Dec 19 '18 at 19:18
add a comment |
If you want to understand why this is, you need to understand the difference between files and inodes. rm, rmdir and mv all take action on the inodes describing the file/directory, not the actual file. If you have a file/dir open (e.g. by being in the directory), the inode information is removed, but the actual data file associated with the file/dir is not removed until all file handles pointing to it are closed. So, when you "cd .." the filesystem can swoop in and remove the directory and all its contents.
https://en.wikipedia.org/wiki/Inode
http://www.grymoire.com/Unix/Inodes.html
that is the exact explanation that i wanted ,thank you so much
– Noshiii
Dec 19 '18 at 19:18
add a comment |
If you want to understand why this is, you need to understand the difference between files and inodes. rm, rmdir and mv all take action on the inodes describing the file/directory, not the actual file. If you have a file/dir open (e.g. by being in the directory), the inode information is removed, but the actual data file associated with the file/dir is not removed until all file handles pointing to it are closed. So, when you "cd .." the filesystem can swoop in and remove the directory and all its contents.
https://en.wikipedia.org/wiki/Inode
http://www.grymoire.com/Unix/Inodes.html
If you want to understand why this is, you need to understand the difference between files and inodes. rm, rmdir and mv all take action on the inodes describing the file/directory, not the actual file. If you have a file/dir open (e.g. by being in the directory), the inode information is removed, but the actual data file associated with the file/dir is not removed until all file handles pointing to it are closed. So, when you "cd .." the filesystem can swoop in and remove the directory and all its contents.
https://en.wikipedia.org/wiki/Inode
http://www.grymoire.com/Unix/Inodes.html
answered Dec 19 '18 at 19:11
Ian McGowan
53928
53928
that is the exact explanation that i wanted ,thank you so much
– Noshiii
Dec 19 '18 at 19:18
add a comment |
that is the exact explanation that i wanted ,thank you so much
– Noshiii
Dec 19 '18 at 19:18
that is the exact explanation that i wanted ,thank you so much
– Noshiii
Dec 19 '18 at 19:18
that is the exact explanation that i wanted ,thank you so much
– Noshiii
Dec 19 '18 at 19:18
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489978%2ftrying-to-remove-current-directory-using-rmdir%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Try and create a file in that directory and you will see it doesn't actually exist. Also if you do
ls -la
you will notice that.
and..
no longer exist. I'm not sure what you expected to happen but to me this doesn't seem like an issue at all. Do you want it to kick you back a directory? Automagically move you to your home directory? Complain that you can't delete a directory that you are currently working from? I don't think any of those would be better or worse than the current behavior.– Jesse_b
Dec 19 '18 at 18:46
my issue is that
rmdir
is simply deleting a directory(on which i am currently working) and it does not even give a error,you are absolutely right that no new file or directory can be made through this directory now but still on usingpwd
it is still showing a directory that actually do not exist in the file system– Noshiii
Dec 19 '18 at 18:51
What are you suggesting should have happened?
rmdir
will only complain if the directory is non-empty. It's akin to deleting a file form the filesystem that a program is currently reading from or writing to. No issues.– Kusalananda
Dec 19 '18 at 19:16
All of this, including the behaviour of
pwd
, is already covered at unix.stackexchange.com/questions/434417 .– JdeBP
Dec 19 '18 at 19:21