Before answering this question it is important one should know about ls command in detail in UNIX or LINUX operating system.
ls command without any option is used to list files and this command list files generally in alphabetical order. That is the command list the files present in a directory with one file per line displayed on the screen. Simply using s command without any option display all files names present in the current working directory. If one likes to display files present in a particular directory then they can do that by naming the directory name after ls command. Say for example if one wants to display all files represent in the directory Exforsys they can do that by giving the command as
ls Exforsys
So having known about the ls command now let us see the requirement of displaying only the directory names. This can be done by using the option as –d with ls command. Suppose if one wants to display all directories under the directory /usr/exfor it can be done as
ls –d /usr/exfor/
What is the command one can use to list only the directory names?
Before answering this question it is important one should know about ls command in detail in UNIX or LINUX operating system.
ls command without any option is used to list files and this command list files generally in alphabetical order. That is the command list the files present in a directory with one file per line displayed on the screen. Simply using s command without any option display all files names present in the current working directory. If one likes to display files present in a particular directory then they can do that by naming the directory name after ls command. Say for example if one wants to display all files represent in the directory Exforsys they can do that by giving the command as
So having known about the ls command now let us see the requirement of displaying only the directory names. This can be done by using the option as –d with ls command. Suppose if one wants to display all directories under the directory /usr/exfor it can be done as
Related Answered Questions
Related Open Questions