What is double dot(..) and single dot(.) in Linux?
The ls -ai command shows that . and .. have their inodes same as current directory and parent directory, respectively.
Could anyone tell me what exactly . and .. are?
Are they real files or even hard links? But as I have known, it's not allowed to create a hard link to a directory.
linux file unix directory
add a comment |
The ls -ai command shows that . and .. have their inodes same as current directory and parent directory, respectively.
Could anyone tell me what exactly . and .. are?
Are they real files or even hard links? But as I have known, it's not allowed to create a hard link to a directory.
linux file unix directory
add a comment |
The ls -ai command shows that . and .. have their inodes same as current directory and parent directory, respectively.
Could anyone tell me what exactly . and .. are?
Are they real files or even hard links? But as I have known, it's not allowed to create a hard link to a directory.
linux file unix directory
The ls -ai command shows that . and .. have their inodes same as current directory and parent directory, respectively.
Could anyone tell me what exactly . and .. are?
Are they real files or even hard links? But as I have known, it's not allowed to create a hard link to a directory.
linux file unix directory
linux file unix directory
edited May 6 '17 at 5:45
codeforester
17.7k84164
17.7k84164
asked Apr 23 '14 at 10:46
CubarcoCubarco
151124
151124
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
They are special name-inode maps which do count as hard-links (they do increase the link-count) though they aren't really hard-links, since, as you said, directories can't have hard-links. Read more here: Hard links and Unix file system nodes (inodes)
add a comment |
. represents the directory you are in and .. represents the parent directory.
From the dot definition:
This is a short string (i.e., sequence of characters) that is added to
the end of the base name (i.e., the main part of the name) of a file
or directory in order to indicate the type of file or directory.
On Unix-like operating systems every directory contains, as a minimum,
an object represented by a single dot and another represented by two
successive dots. The former refers to the directory itself and the
latter refers to its parent directory (i.e., the directory that
contains it). These items are automatically created in every
directory, as can be seen by using the ls command with its -a option
(which instructs it to show all of its contents, including hidden
items).
1
Are they real files as hard links to directories?
– Cubarco
Apr 23 '14 at 10:52
@Cubarco:- These are not the hardlinks!
– Rahul Tripathi
Apr 23 '14 at 11:07
But I think @e.dan's answer completely solved my problem...
– Cubarco
Apr 23 '14 at 11:15
I don't know why this answer has so many upvotes. The questions specifically asks "what exactly . and .. are?" not "what do they represent" or "what do they do"
– Gerard Simpson
Oct 2 '18 at 1:01
add a comment |
They are not hard links. You can more think it like a short hand for (.) this Directory and (..) parent of this directory.
try to remove or rename . or .. then you understand why it is not a hard link.
add a comment |
. represents the current directory that you are using and
.. represents the parent directory.
example:
Suppose you are in the directory /etc/mysql and you wanted to move to parent directory i.e. /etc/ then use cd..
/etc/mysql> cd ..
and if you wanted to set path of one file in current directory bash file use . with file name like this ./filename
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2fstackoverflow.com%2fquestions%2f23242004%2fwhat-is-double-dot-and-single-dot-in-linux%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
They are special name-inode maps which do count as hard-links (they do increase the link-count) though they aren't really hard-links, since, as you said, directories can't have hard-links. Read more here: Hard links and Unix file system nodes (inodes)
add a comment |
They are special name-inode maps which do count as hard-links (they do increase the link-count) though they aren't really hard-links, since, as you said, directories can't have hard-links. Read more here: Hard links and Unix file system nodes (inodes)
add a comment |
They are special name-inode maps which do count as hard-links (they do increase the link-count) though they aren't really hard-links, since, as you said, directories can't have hard-links. Read more here: Hard links and Unix file system nodes (inodes)
They are special name-inode maps which do count as hard-links (they do increase the link-count) though they aren't really hard-links, since, as you said, directories can't have hard-links. Read more here: Hard links and Unix file system nodes (inodes)
answered Apr 23 '14 at 10:56
e.dane.dan
5,61811522
5,61811522
add a comment |
add a comment |
. represents the directory you are in and .. represents the parent directory.
From the dot definition:
This is a short string (i.e., sequence of characters) that is added to
the end of the base name (i.e., the main part of the name) of a file
or directory in order to indicate the type of file or directory.
On Unix-like operating systems every directory contains, as a minimum,
an object represented by a single dot and another represented by two
successive dots. The former refers to the directory itself and the
latter refers to its parent directory (i.e., the directory that
contains it). These items are automatically created in every
directory, as can be seen by using the ls command with its -a option
(which instructs it to show all of its contents, including hidden
items).
1
Are they real files as hard links to directories?
– Cubarco
Apr 23 '14 at 10:52
@Cubarco:- These are not the hardlinks!
– Rahul Tripathi
Apr 23 '14 at 11:07
But I think @e.dan's answer completely solved my problem...
– Cubarco
Apr 23 '14 at 11:15
I don't know why this answer has so many upvotes. The questions specifically asks "what exactly . and .. are?" not "what do they represent" or "what do they do"
– Gerard Simpson
Oct 2 '18 at 1:01
add a comment |
. represents the directory you are in and .. represents the parent directory.
From the dot definition:
This is a short string (i.e., sequence of characters) that is added to
the end of the base name (i.e., the main part of the name) of a file
or directory in order to indicate the type of file or directory.
On Unix-like operating systems every directory contains, as a minimum,
an object represented by a single dot and another represented by two
successive dots. The former refers to the directory itself and the
latter refers to its parent directory (i.e., the directory that
contains it). These items are automatically created in every
directory, as can be seen by using the ls command with its -a option
(which instructs it to show all of its contents, including hidden
items).
1
Are they real files as hard links to directories?
– Cubarco
Apr 23 '14 at 10:52
@Cubarco:- These are not the hardlinks!
– Rahul Tripathi
Apr 23 '14 at 11:07
But I think @e.dan's answer completely solved my problem...
– Cubarco
Apr 23 '14 at 11:15
I don't know why this answer has so many upvotes. The questions specifically asks "what exactly . and .. are?" not "what do they represent" or "what do they do"
– Gerard Simpson
Oct 2 '18 at 1:01
add a comment |
. represents the directory you are in and .. represents the parent directory.
From the dot definition:
This is a short string (i.e., sequence of characters) that is added to
the end of the base name (i.e., the main part of the name) of a file
or directory in order to indicate the type of file or directory.
On Unix-like operating systems every directory contains, as a minimum,
an object represented by a single dot and another represented by two
successive dots. The former refers to the directory itself and the
latter refers to its parent directory (i.e., the directory that
contains it). These items are automatically created in every
directory, as can be seen by using the ls command with its -a option
(which instructs it to show all of its contents, including hidden
items).
. represents the directory you are in and .. represents the parent directory.
From the dot definition:
This is a short string (i.e., sequence of characters) that is added to
the end of the base name (i.e., the main part of the name) of a file
or directory in order to indicate the type of file or directory.
On Unix-like operating systems every directory contains, as a minimum,
an object represented by a single dot and another represented by two
successive dots. The former refers to the directory itself and the
latter refers to its parent directory (i.e., the directory that
contains it). These items are automatically created in every
directory, as can be seen by using the ls command with its -a option
(which instructs it to show all of its contents, including hidden
items).
answered Apr 23 '14 at 10:50
Rahul TripathiRahul Tripathi
127k21163238
127k21163238
1
Are they real files as hard links to directories?
– Cubarco
Apr 23 '14 at 10:52
@Cubarco:- These are not the hardlinks!
– Rahul Tripathi
Apr 23 '14 at 11:07
But I think @e.dan's answer completely solved my problem...
– Cubarco
Apr 23 '14 at 11:15
I don't know why this answer has so many upvotes. The questions specifically asks "what exactly . and .. are?" not "what do they represent" or "what do they do"
– Gerard Simpson
Oct 2 '18 at 1:01
add a comment |
1
Are they real files as hard links to directories?
– Cubarco
Apr 23 '14 at 10:52
@Cubarco:- These are not the hardlinks!
– Rahul Tripathi
Apr 23 '14 at 11:07
But I think @e.dan's answer completely solved my problem...
– Cubarco
Apr 23 '14 at 11:15
I don't know why this answer has so many upvotes. The questions specifically asks "what exactly . and .. are?" not "what do they represent" or "what do they do"
– Gerard Simpson
Oct 2 '18 at 1:01
1
1
Are they real files as hard links to directories?
– Cubarco
Apr 23 '14 at 10:52
Are they real files as hard links to directories?
– Cubarco
Apr 23 '14 at 10:52
@Cubarco:- These are not the hardlinks!
– Rahul Tripathi
Apr 23 '14 at 11:07
@Cubarco:- These are not the hardlinks!
– Rahul Tripathi
Apr 23 '14 at 11:07
But I think @e.dan's answer completely solved my problem...
– Cubarco
Apr 23 '14 at 11:15
But I think @e.dan's answer completely solved my problem...
– Cubarco
Apr 23 '14 at 11:15
I don't know why this answer has so many upvotes. The questions specifically asks "what exactly . and .. are?" not "what do they represent" or "what do they do"
– Gerard Simpson
Oct 2 '18 at 1:01
I don't know why this answer has so many upvotes. The questions specifically asks "what exactly . and .. are?" not "what do they represent" or "what do they do"
– Gerard Simpson
Oct 2 '18 at 1:01
add a comment |
They are not hard links. You can more think it like a short hand for (.) this Directory and (..) parent of this directory.
try to remove or rename . or .. then you understand why it is not a hard link.
add a comment |
They are not hard links. You can more think it like a short hand for (.) this Directory and (..) parent of this directory.
try to remove or rename . or .. then you understand why it is not a hard link.
add a comment |
They are not hard links. You can more think it like a short hand for (.) this Directory and (..) parent of this directory.
try to remove or rename . or .. then you understand why it is not a hard link.
They are not hard links. You can more think it like a short hand for (.) this Directory and (..) parent of this directory.
try to remove or rename . or .. then you understand why it is not a hard link.
answered Apr 23 '14 at 10:59
Nafis AhmadNafis Ahmad
1,7051912
1,7051912
add a comment |
add a comment |
. represents the current directory that you are using and
.. represents the parent directory.
example:
Suppose you are in the directory /etc/mysql and you wanted to move to parent directory i.e. /etc/ then use cd..
/etc/mysql> cd ..
and if you wanted to set path of one file in current directory bash file use . with file name like this ./filename
add a comment |
. represents the current directory that you are using and
.. represents the parent directory.
example:
Suppose you are in the directory /etc/mysql and you wanted to move to parent directory i.e. /etc/ then use cd..
/etc/mysql> cd ..
and if you wanted to set path of one file in current directory bash file use . with file name like this ./filename
add a comment |
. represents the current directory that you are using and
.. represents the parent directory.
example:
Suppose you are in the directory /etc/mysql and you wanted to move to parent directory i.e. /etc/ then use cd..
/etc/mysql> cd ..
and if you wanted to set path of one file in current directory bash file use . with file name like this ./filename
. represents the current directory that you are using and
.. represents the parent directory.
example:
Suppose you are in the directory /etc/mysql and you wanted to move to parent directory i.e. /etc/ then use cd..
/etc/mysql> cd ..
and if you wanted to set path of one file in current directory bash file use . with file name like this ./filename
edited Jan 3 at 11:25
answered Jun 5 '17 at 12:47
DevaDeva
997
997
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f23242004%2fwhat-is-double-dot-and-single-dot-in-linux%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