Table of Contents

Linux#

$ ls -l | grep "^d"

$ find . -type d -maxdepth 1 -mindepth 1

$ tree -d -L 1

$ ls -d */

$ tree -fid

lets your format however you want

$ find . -type d -printf ā€˜%P\nā€™
$ ls -R | grep ./

Escapes the spaces. Can be useful

$ find . -type d | sed ā€™s/ /\\ /gā€™

Print directory names one line at a time, without any other characters (and pipeless):

$ find . -maxdepth 1 -mindepth 1 -type d -printf %P\\n

Sources#


CategoryComputing.Linux.Shell