Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

List all files in the directory and all subdirectories that have been modified w

ID: 3753006 • Letter: L

Question

List all files in the directory and all subdirectories that have been modified within the last 30 days. How many are they? List the number (count) of the files listed as well. First, you may run this command with a pipe to wc command to get an estimate for the number of the files.

(Note. You may be a bit overwhelmed by the sheer size of /etc directory. To avoid those files without your access, you may get first the list of the files to find first those files that you can access to work with.)

command(s) in pipe, including find command, to do this task

the result of command(s) run – the list of the files and then the count

Task#2. List all files you have read access in the directory and all subdirectories that are larger than 1 kilobyte.

How many are they? List the number (count) of the files listed as well. You may run the same command pipe to wc command to list the number of the files.

command(s) in pipe, including find command, to do this task

the result of command(s) run – the list of the files and then the count

Task#3. List the inode numbers of all files in the directory whose filenames end in .c.

command(s) in pipe, including find command, to do this task

the result of command(s) run – the list of the files and then the count

command(s) in pipe, including find command, to do this task

Explanation / Answer

Task 1

to print the file names

find . -mtime -30

to get count using wc

find . -mtime -30 | wc -l

-mtime specify no of days

Task 2

to print the file names size greater than 1 kilobyte

find . -type f -size +1k

to print the no of files using wc

find . -type f -size +1k | wc -l

Task 3

to print the files inode numbers end with .c

find -maxdepth 1 -type f -name '*.c' -printf "%i "

to get the count using wc

find -maxdepth 1 -type f -name '*.c' -printf "%i " | wc -l

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote