I am trying to find the latest modified files in my system say in the last 2 hours or so. The command that I am using is:
sudo find / -mmin -120 -printf '%T@ %p\n' | sort -n | cut -f2- -d" " | more
But the above command outputs a lot of entries that contain the string /proc
. So, are there any better ways by which I can remove those lines from the output?
Also, if you have any better methods to deal with the above situation then please suggest. The only criteria is that the output should contain files as well as directories.
EDIT:-
I modified the above command to also include names with newline
, then added Arronical's answer and αғsнιη's answer to it. The final outcome is:
sudo find / ! -path '*/proc*' -type f -mmin -120 -exec ls -al {} \; | grep -v anystring | less
/proc
?grep -v /proc
.find
already has anls
option that does pretty much the same thing asls -al
. In any case, file names with newlines aren't a problem here, not if you just want to see the list. So just dosudo find / ! -path '*/proc*' -type f -mmin -120 | less