Listing only directories using ls in bash: An examination
问题 This command lists directories in the current path: ls -d */ What exactly does the pattern */ do? And how can we give the absolute path in the above command (e.g. ls -d /home/alice/Documents ) for listing only directories in that path? 回答1: */ is a pattern that matches all of the subdirectories in the current directory ( * would match all files and subdirectories; the / restricts it to directories). Similarly, to list all subdirectories under /home/alice/Documents, use ls -d /home/alice