Skip to content

Instantly share code, notes, and snippets.

@b10n1k
Created December 11, 2019 09:22
Show Gist options
  • Save b10n1k/2b8b3bbbfbe2483d75807911d1709588 to your computer and use it in GitHub Desktop.
Save b10n1k/2b8b3bbbfbe2483d75807911d1709588 to your computer and use it in GitHub Desktop.
Display the meaning of colorful bash output
eval $(echo "no:global default;fi:normal file;di:directory;ln:symbolic link;pi:named pipe;so:socket;do:door;bd:block device;cd:character device;or:orphan symlink;mi:missing file;su:set uid;sg:set gid;tw:sticky other writable;ow:other writable;st:sticky;ex:executable;"|sed -e 's/:/="/g; s/\;/"\n/g')
{
IFS=:
for i in $LS_COLORS
do
echo -e "\e[${i#*=}m$( x=${i%=*}; [ "${!x}" ] && echo "${!x}" || echo "$x" )\e[m"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment