| 1 | #!/bin/bash |
| 2 | # fileinfo.sh |
| 3 | |
| 4 | FILES="/usr/sbin/accept |
| 5 | /usr/sbin/pwck |
| 6 | /usr/sbin/chroot |
| 7 | /usr/bin/fakefile |
| 8 | /sbin/badblocks |
| 9 | /sbin/ypbind" # List of files you are curious about. |
| 10 | # Threw in a dummy file, /usr/bin/fakefile. |
| 11 | |
| 12 | echo |
| 13 | |
| 14 | for file in $FILES |
| 15 | do |
| 16 | |
| 17 | if [ ! -e "$file" ] # Check if file exists. |
| 18 | then |
| 19 | echo "$file does not exist."; echo |
| 20 | continue # On to next. |
| 21 | fi |
| 22 | |
| 23 | ls -l $file | awk '{ print $8 " file size: " $5 }' # Print 2 fields. |
| 24 | whatis `basename $file` # File info. |
| 25 | # Note that the whatis database needs to have been set up for this to work. |
| 26 | # To do this, as root run /usr/bin/makewhatis. |
| 27 | echo |
| 28 | done |
| 29 | |
| 30 | exit 0 |