Whenever you type ls -a into the command prompt, you usually get all of your folders, files, and then you see that the first two entries are . and ..
Just curious, but what is the significance of these two entries?
Whenever you type ls -a into the command prompt, you usually get all of your folders, files, and then you see that the first two entries are . and ..
Just curious, but what is the significance of these two entries?
. is the relative reference for the current directory.
.. is the relative reference for the parent directory.
This is why cd .. makes the parent directory the new working directory.
./ that you have to type when you want to run a executable from the current directory. It's the equivalent to typing /the/full/path/to/the/executable. (had one of these "ahh" moments when I realized that :) )
– alextsc
Oct 01 '11 at 19:58
. and .. are hard links to the current and the parent directory
(/ is the parent of itself).
With the -a option ls shows all inodes in the current directory, i.e. also the hidden files which filenames begin with ad dot, therefore . and .. are shown.
you must be knowing that Directory is nothing but a file that points to some list of files, basically it is a pointer, may be hidden or not.
in similar way . and .. are the pointer which point to Uppermost directory and upper directory respectively.
that is why i think when we execute
ls -a
command, these are displayed!
.and..you can usels -A. – Nykakin Apr 24 '13 at 12:01.character, in most locales, sorts before the characters usually used as the first character of a file name (but there still are plenty of characters that sort before.). – Stéphane Chazelas Jan 02 '16 at 21:48