Created
March 26, 2016 00:53
-
-
Save wallentx/973da62b6d6b7fef751d to your computer and use it in GitHub Desktop.
A combination of ls and stat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script will print a colorized list of files and folders from the current directory | |
# and show the user:group ownership, as well as the file permissions in a human-readable format | |
# TODO: add options to show/hide hidden files | |
LSOWN=$(ls -ACl --group-directories-first . | awk '{print $9}' | sed 1d) | |
CLIST=$(ls -AFCl --group-directories-first --color=always . | awk '{print $9}' | sed 1d) | |
statlist () { | |
for i in $LSOWN; do | |
stat -c '%a %U:%G' $i; | |
done | |
} | |
STAT=$(statlist) | |
paste <(echo "$STAT") <(echo "$CLIST") -d ' ' | column -t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment