A colleague asks for a list of every config in /etc — the files whose names end in .conf. They want a file they can forward. You run a search and send its output to a file with >, as in the lesson on paths.
Collect the list of configs
You are in ~/stream-lab. Run the three commands in turn: the search written to conf-list.txt, a count of lines with the word denied in that file, and the first three lines of the file.
First, predict
find's output goes to a file. What appears on the screen after the first command?
Now start the exercise, run the command and compare your prediction with the output.
Why did the Permission denied messages stay on the screen while conf-list.txt has none of them?
-
File permissions do not depend on which lines are written: the paths made it into conf-list.txt, so student can write to it.
-
>writes whatever text reaches it:echo hello > test.txtwrites a word with no/. The messages never reached that text. -
A file has no limit of a few lines:
headshowed paths in conf-list.txt, andgrep -c deniedfound not one message there.
The refusal messages went past the file: > redirected the list of paths alone.