Having the following simple structure:
project
main
aaa
aaa
test
ddd
ddd
pom.xml <--- unique regular file
If the current directory is project
and if is executed the ls
command appears
main pom.xml test
Until here all is OK. Now, according with man ls
about the d
option exists:
-d, --directory
list directories themselves, not their contents
Thus when is executed the ls -d
command appears:
.
Why? To be honest I expected only the directories and not regular files. Such as
main test
Question
- How does the
d
option for thels
command exactly work?
Extra question:
- What does not their contents exactly mean? Is it about of the internal content of each directory?
ls -d
is the same asls -d .
- so why the dot is not interpreted as the current directory as relative path and is not shown themain
andtest
directories? – Manuel Jordan Mar 13 '24 at 13:47ls -d .
would display the.
directory and not the contents of the.
directory; You can see this if you combine withl
flag; egls -ld .
will show permissions and inode and stuff for the directory itself. – Stephen Harris Mar 13 '24 at 15:54ls -d project/*
command returnsproject/main project/pom.xml project/test
. Therefore consider to fix that part and explain why appears thepom.xml
file – Manuel Jordan Mar 13 '24 at 23:06