•Exercises "find"

WORK/SYSTEM 2009. 11. 16. 11:27

http://find.unixpin.com/index.html

1-Write the complete rute of a file whose inode number is 705.
find / -inum 705 -print > exit  2>/dev/null


2-Count the number of characters of the "myfile" file that you can find in somewhere of the system.
find / -name myfile -exec wc -c {} \;


3-Write the inode number of the "myfile" that you can find in somewhere of the system.
find / -name myfile -print -exec ls -li {} \;


4-Write a list of files (no directories) that were modified or acceded since 10 days before.
find / ! -type d -mtime +10 -o -atime +10 -print


5-Count the number of files (no directories) that have been modified the last 24 hours. 
find / ! -type d -mtime -1 -print | wc -l


6-Write a long list of all "/dev" files whose type is different of type block.
find /dev ! -type b -exec ls -l {} \ ;


7-Write a list of "\etc" files whose permissions are "r-x r-x r-x". Besides you have to send the standard exit to a file named "exit_standard" and  diagnosis exit to "/dev/null".
find /etc -perm 555 -print > exit_standard  2>/dev/null


8-Find the "file1" file and copy it in home directory with the name "file2".
find / -name file1 -exec cp  {} $HOME/file2 \;


9-Modify all permissions (rwx r-x r--) of  all "/etc" files.
find /etc -exec chmod 754 {} \;


10-Count the number of files with soft links in root.
find / -type f -a -user root -print | wc -l

Posted by yangdaegam
l