Sort the output of ‘ls’ Sort ls output – Directories, then files, then links: ls -la | grep "^d" && ls -la | grep "^-" && ls -la | grep "^l"