Linuxzoo Pipes: Write a command for the following question Question 13: find new
ID: 3817886 • Letter: L
Question
Linuxzoo Pipes: Write a command for the following question
Question 13: find new files
Find all the files and directories in the demo directory that are newer than s1. Send the output of the command to /var/tmp/t1 (don't send it to the demo directory). The names of the files should appear as full names. For example, the file "s5" would appear as "/home/demo/s5". The "/home/demo", if it appears in the output, should not have a trailing "/". The secret to avoiding the trailing slash is to use "/home/demo" not "/home/demo/" in the find command.
Explanation / Answer
find /home/demo -maxdepth 1 -never s1 > /var/tmp/t1
explaination:
find <search path> => search path is /home/demo please note no trailing / otherwise it will be repeated in output
full path is needed so that output has full path
- maxdepth 1 to search only files and folder in demo directory and not go inside sub directories
-newer <filename> to check for file newer than fiven file
> redirection opertor redirecting output to file.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.