#!/bin/bash # stat2: Display just about everything about a file except its data -- Matt McCutchen indent=$'|\t' while [ "$#" != "0" ] ; do echo "File $1" echo "+-- Basic i-node information from \`stat':" stat -- "$1" | sed -e "s/^/$indent/" echo "+-- File version/generation and attributes from \`lsattr':" lsattr -d -v -- "$1" | (read version attributes filenameignored && echo "$indent$version $attributes") if [ ! -h "$1" ] ; then echo "+-- POSIX ACLs from \`getfacl':" getfacl --absolute-names --tabular -- "$1" | tail -n +2 | head -n -1 | sed -e "s/^/$indent/" fi echo "+-- Extended attributes in all namespaces from \`getfattr':" # Add -P, otherwise the getfattr command printed xattrs of subdirectories # when passed ~/cc (a symlink). I think this is a bug. TODO: report it. # ~ 2010-05-16 getfattr --absolute-names -h -d -m '' -P -- "$1" | tail -n +2 | head -n -1 | sed -e "s/^/$indent/" echo "'---------------------------------------" shift done