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

Questions related to the command line use of Linux. 16. Find all files under ~ w

ID: 3722930 • Letter: Q

Question

 Questions related to the command line use of Linux. 
  16. Find all files under ~ whose content contain the keyword pizza OR PIZZA OR piZZa OR pizzA. Not all variations in case for 'pizza', but just the variations listed.   17. Find all files under the current directory whose extension is *.txt and use -exec to create a listing of each files inode number.   18. What command would I run to update the database of file names used by the locate command?   19. Find all files under the /tmp directory whose size is greater than 80 kilobytes.  Use -exec and an appropriate command to delete these files.   20. Find all files under the current directory that are named 'taco' ignoring case. 

Explanation / Answer


16. Find all files under ~ whose content contain the keyword pizza OR PIZZA OR piZZa OR pizzA. Not all variations in case for 'pizza', but just the variations listed.

Answer:grep -Ril "PIZZA" /

where,
i stands for ignore case.
R stands for recursive.
l stands for "show the file name, not the result itself".
/ stands for starting at the root directory.


17. Find all files under the current directory whose extension is *.txt and use -exec to create a listing of each files inode number.


Answer: $ find -name '*.txt' -exec ls -i /home(or)Current Directory;


18. What command would I run to update the database of file names used by the locate command?


Use "updatedb" Command to update the Database Files.When you execute "updatedb", it scans the whole system and updates the mlocate.db database file.
The locate database file is located at:/var/lib/mlocate/mlocate.db

Answer:$locate updatedb.

19. Find all files under the /tmp directory whose size is greater than 80 kilobytes. Use -exec and an appropriate command to delete these files.

$ find /tmp -size +80K -exec /bin/rm {} ;


20. Find all files under the current directory that are named 'taco' ignoring case.

$ find -iname 'taco'