This repository has been archived on 2024-03-04. You can view files and clone it, but cannot push or open issues or pull requests.
linux/.config/bash/module/ls.sh

46 lines
871 B
Bash

# unset possible system-defined aliases.
unalias l ll lll llll la lla &> /dev/null
unset l ll lll llll la lla &> /dev/null
# list files in dir.
l() {
ls -lhv --si --group-directories-first "$@"
}
# list last modified files first.
ll() {
ls -lhvtr --si "$@"
}
# list files in tree structure.
# usage: lll [DEPTH] [DIRS]
lll() {
local IFS=$'\n'
local depth="${1}"
local target=("${@:2}")
[[ "${target}" = "" ]] && target="."
[[ "${depth}" = "" ]] && depth=666
[[ "${depth}" = "-" ]] && depth=666
tree -a -L "${depth}" -- "${target[@]}"
}
# list files recursively.
llll() {
ls -RlAhv --si --group-directories-first "$@"
}
# list all files in dir, incl. hidden files.
la() {
ls -lAh --si --group-directories-first "$@"
}
# list all files in dir, incl. hidden files, sorted by mtime.
lla() {
ls -lAhtr --si "$@"
}
# export.
export -f l ll lll llll la lla