UNIX question What EXACTLY will this alias do when it is executed alias dirc 'ls -l grep 'd' wc -l'?

1 answer

Answer

1048683

2026-03-04 09:45

+ Follow

The alias dirc will execute a command pipeline when invoked. It will list all files and directories in the current directory in long format (ls -l), then filter that output to include only lines containing the letter 'd' (which typically indicates directories) using grep 'd'. Finally, it will count the number of lines output by grep using wc -l, effectively giving the total count of directories in the current directory. Note that the alias as written has a syntax error and should include pipes (|) between commands for it to work correctly.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.