The actual homework question is
- List all files/directories NOT owned by root and not created in July.
I can't find a way to use
ls
and
grep
to output a file ~/NotOwnedByRoot.txt
find / \! -user root -d -maxdepth 1 -exec ls > ~/NotOwnedByRoot.txt {} +
I also tried
find / \! -user root -type d -maxdepth 1 > ~/NotOwnedByRoot.txt
I get the error
find: warning: you have specified the -maxdepth option after a non-option argument !, but options are not positional (-maxdepth affects tests specified before it as well as those specified after it). Please specify options before other arguments.
ls
. You should probably look into either usingfind
or simple shell globbing to get your list of files to process. Extensive further reading on the subject can be found here. – DopeGhoti Mar 06 '19 at 17:40