Import the remaining utilities.
[utils/utils.git] / stat2
diff --git a/stat2 b/stat2
new file mode 100755 (executable)
index 0000000..e3b9845
--- /dev/null
+++ b/stat2
@@ -0,0 +1,19 @@
+#!/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':"
+       getfattr --absolute-names -h -d -m '' -- "$1" | tail -n +2 | head -n -1 | sed -e "s/^/$indent/"
+       echo "'---------------------------------------"
+       shift
+done