Linux File Systems:
Please write down a pseudo code that implements shell command “find
. -name myfile -print”.
find . -name myfile -print
-What this will do is ,it tells the find command to look inside
the .directory and it's every subdirectory to search for a
directory with the name given myfile
and to display each match it finds
find . -name “foo*” -amin -5 -print
-What this will do is ,it tells the find command to search
inside the current directory and every subdirectory of it's to look
for a file with name begin with "foo" that
have been accessed in the last 5 minutes and to display each match
it finds
Similarly,
find . -name “foo*” -amin -15 -print
This will get the last accessed files anmes which it finds in last
15 minutes.
Pseudo code:
$ # Let's make some test files $ mkdir ASCII-finder $ cd
ASCII-finder $ dd if=/dev/urandom of=binary.file bs=1M count=1
1+0
records in 1+0 records out 1048576 bytes (1.0 MB, 1.0 MiB) copied,
0.009023 s,
116 MB/s $ file binary.file binary.file: data $ echo 123 >
text.txt
$ # Let the magic begin $ find -myfile-print0 | \ xargs -0 -I @@
bash -c 'file "$@" | grep ASCII &>/dev/null && echo
"file is ASCII: $@"' -- @@
I hope this might help you and don't forget to give UPVOTE s it means a lot.THANKS:)
Get Answers For Free
Most questions answered within 1 hours.