LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   ls -d (https://www.linuxquestions.org/questions/linux-newbie-8/ls-d-4175580852/)

krishnar 05-27-2016 11:59 AM

ls -d
 
Hi guys,

I am wondering what does ls -d command do?

ubuntu@Ubuntu-Machine:~$ ls -d
.
ubuntu@Ubuntu-Machine:~$

ls helps shows it will list the directories.

-d, --directory list directory entries instead of contents,and do not dereference symbolic links

But I don't see it listing all the directories instead on '.'.

TB0ne 05-27-2016 12:28 PM

Quote:

Originally Posted by krishnar (Post 5551838)
Hi guys,
I am wondering what does ls -d command do?

ls helps shows it will list the directories.

-d, --directory list directory entries instead of contents,and do not dereference symbolic links

But I don't see it listing all the directories instead on '.'.

Right...because ls by default, references the current directory. If you want to see just the directories within a directory, use "ls -d */"

Fred Caro 05-27-2016 07:36 PM

TB0ne.

Quote:

ls -d */"
gets you

Quote:

>
but

Quote:

ls -d */
lists just the directories inside the current directory you are in, something to do with builtin commands.

Fred.

keefaz 05-28-2016 04:55 AM

lol

TB0ne 05-28-2016 01:27 PM

Quote:

Originally Posted by Fred Caro (Post 5551989)
TB0ne.

gets you

but lists just the directories inside the current directory you are in, something to do with builtin commands.

Fred.

Right...which is exactly the same command I posted initially. You just put in a trailing double-quote, which is what I wrapped the command in when I posted it. There was also a LEADING double-quote too, if you'll notice.

Fred Caro 05-28-2016 07:35 PM

oops,

yes "without quotes" use this: ...

apologies,

Fred.


All times are GMT -5. The time now is 09:20 PM.