Intermediate Linux & Shell Scripting
Q47 / 100

What does the command "ls -la | grep '^d'" accomplish?

Correct! Well done.

Incorrect.

The correct answer is A) It lists all files and directories in long format, then filters the output to show only lines starting with "d" (which represents directories in the permissions field)

A

Correct Answer

It lists all files and directories in long format, then filters the output to show only lines starting with "d" (which represents directories in the permissions field)

Explanation

In "ls -l" output, the first character of the permissions string indicates file type — "d" for directories. Piping to "grep '^d'" filters lines where that first character is "d", effectively listing only directories.

Progress
47/100