profile.d/etc/profile.d/z-aliases.sh

36 lines
993 B
Bash
Raw Normal View History

if [ "${BASH_SOURCE-}" = "$0" ]; then
echo -e "You must source this script:\n\tsource $0" >&2
exit 33
fi
# show hidden files and directories
alias l.='ls -d .[^.]* ..?* --color=tty 2>/dev/null'
if ! which ll >/dev/null 2>&1; then
2024-04-26 15:13:11 +03:00
alias ll='ls -l --color=auto'
fi
2024-04-26 16:00:57 +03:00
# color less (restricted)
alias less='less -R'
2024-04-26 15:13:11 +03:00
if [[ "$OSTYPE" != darwin* ]]; then
# long format with ISO dates
2024-05-14 11:22:25 +03:00
alias lll='ls --color=auto -Al "--time-style=+%Y-%m-%d %H:%M:%S GMT%z"'
# if there is iproute installed
if command -v ip > /dev/null; then
# color ip route
if ip -V | grep '^ip utility, iproute2-.*, libbpf' &>/dev/null; then
# EL 8+ - "ip utility, iproute2-6.2.0, libbpf 0.5.0"
alias ip='ip --color=auto'
else
# EL 7 - "ip utility, iproute2-ss170501"
alias ip='ip -c'
fi
2024-04-26 16:00:57 +03:00
fi
2024-05-14 10:40:19 +03:00
else
# MacOS aliases
alias ll='ls --color=auto -l'
2024-05-14 11:22:25 +03:00
alias lll='ls --color=auto -Al -D "%Y-%m-%d %H:%M:%S GMT%z"'
fi