Last active
October 12, 2021 23:20
-
-
Save jeetsukumaran/122ffcf5f011bebb4bc6f11e334e0067 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Colorized ``ls`` | |
# | |
# ``ls`` has native support for colorizing the entries themselves, which can | |
# be seen by running ``ls --color`` or ``ls --color=auto``, and this can be | |
# made standard by aliasing these to ``ls`` in your ``.bashrc. | |
# | |
# The colors of the file/directory entries themselves can be customized by | |
# adding the following in your ``~/.bashrc`` : | |
# | |
# ~~~ | |
# export LS_COLORS='di=0;96:fi=1;94:ln=4;94:pi=5:so=5:bd=5:cd=5:or=1;5;40:mi=1;5;40:ex=32' | |
# ~~~ | |
# | |
# However, when doing long lists (``ls -l``) the other columns of the table | |
# are not colorized. | |
# | |
# The following function, placed in your ``~/,bashrc.``, "fixes" this ... :) | |
# | |
# (You can make this the 'default' view by adding ``alias ll=llc`` or ``alias | |
# ls=llc`` in your ``~/.bashrc`` | |
# | |
function llc() { | |
ls -lh --color $@ | awk ' | |
BEGIN { | |
FPAT = "([[:space:]]*[^[:space:]]+)"; | |
OFS = ""; | |
} | |
{ | |
$1 = "\033[0;95m" $1 "\033[0m"; | |
$2 = "\033[1;94m" $2 "\033[0m"; | |
$3 = "\033[1;34m" $3 "\033[0m"; | |
$4 = "\033[1;34m" $4 "\033[0m"; | |
$5 = "\033[0;32m" $5 "\033[0m"; | |
$6 = "\033[0;33m" $6 "\033[0m"; | |
$7 = "\033[0;33m" $7 "\033[0m"; | |
$8 = "\033[1;33m" $8 "\033[0m"; | |
} | |
' | |
} | |
This file contains hidden or 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
# Colorized ``ls`` | |
# | |
# ``ls`` has native support for colorizing the entries themselves, which can | |
# be seen by running ``ls --color`` or ``ls --color=auto``, and this can be | |
# made standard by aliasing these to ``ls`` in your ``.bashrc. | |
# | |
# The colors of the file/directory entries themselves can be customized by | |
# adding the following in your ``~/.bashrc`` : | |
# | |
# ~~~ | |
# export LS_COLORS='di=0;96:fi=1;94:ln=4;94:pi=5:so=5:bd=5:cd=5:or=1;5;40:mi=1;5;40:ex=32' | |
# ~~~ | |
# | |
# However, when doing along lists (``ls -l``) the other columns of the table | |
# are not colorized. | |
# | |
# The following function, placed in your ``~/,bashrc.``, "fixes" this ... :) | |
# | |
# (You can make this the 'default' view by adding ``alias ll=llc`` or ``alias | |
# ls=llc`` in your ``~/.bashrc`` | |
# | |
# | |
function llc() { | |
ls -lh --color $@ | awk ' | |
BEGIN { | |
FPAT = "([[:space:]]*[^[:space:]]+)"; | |
OFS = ""; | |
} | |
{ | |
$1 = "\033[38;5;102m" $1 "\033[0m"; | |
$2 = "\033[38;5;166m" $2 "\033[0m"; | |
$3 = "\033[38;5;180m" $3 "\033[0m"; | |
$4 = "\033[38;5;180m" $4 "\033[0m"; | |
$5 = "\033[38;5;202m" $5 "\033[0m"; | |
$6 = "\033[38;5;222m" $6 "\033[0m"; | |
$7 = "\033[38;5;222m" $7 "\033[0m"; | |
$8 = "\033[38;5;178m" $8 "\033[0m"; | |
} | |
' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment