Your best bet for questions like these is to simply read the manual.
You can do this by typing the command man in the command line or just Google it.
In that case man ls
For the option -d or --directory we got:
list directories themselves, not their contents
That description is pretty self explanatory.
To view the man in your Browser:
https://man7.org/linux/man-pages/man1/ls.1.html
Also I'd like to point out Pilot's comment. The outputs differ based on what shell you use. But since you're new on here I assume you use the terminal on Ubuntu.
Edit to match the answer to the comments:
The command just outputs the current directory.
If you have a folder x with 3 items inside and run the command inside that folder you will get the single dot. The items inside the folder are NOT listed. Just the folder itself.
It will not always output the dot however. If you use the ls command on another folder it will output that path.
f.e.
ls -d /usr/bin
will output /usr/bin.
Like the other answers already said: Alone this command is rather useless. It simply prints the folder, which you already know. However: If you are in the terminal of a specific folder and want to view the permissions of that folder, without moving out of it you could use ls -dl
.
drwxrwxr-x 2 test test 4096 Feb 16 13:53 .
Using ls -l without the d option will simply print the permission masks of the contents.
Let's say we want to change the permissions now and revoke the write permission for everyone. We are in that folder called test.
We could now do chmod a-w `ls -d`
Keep in mind that chmod changes the permissions, a stands for all (owner, group and others) and the -w revokes the write permission. If we now retype the ls -dl command from before we get:
dr-xr-xr-x 2 test test 4096 Feb 16 13:53 .
In summary
If you want to target the folder you are inside you can use the -d command. Using it alone with ls will simply do nothing. This command is not necessary however. You can simply work around by targeting the folder from outside it, f.e. just do cd . and apply chmod on the test folder. But if for whatever reason you don't want to leave the folder you can use this comand.
I hope now everything is clear.