What does ^d mean in ls -l | grep ^d?
Andy's answer is correct, as seen in the man page:
Anchoring
The caret ^ and the dollar sign $ are meta-characters that respectively match the empty string at the beginning and end of a line.
The reason it works is the -l
flag to ls
makes it use the long-listing format. The first thing shown in each line is the human-readable permissions for the file, and the first character of that is either d
for a directory or -
for a file
That's a caret, not a carrot. It means "beginning of the line." The grep is matching only lines that start with "d".