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

52 lines
900 B
Bash
Raw Normal View History

2023-08-08 16:24:15 +03:00
# unset possible system-defined aliases.
unalias l ll lll llll la laa &> /dev/null
unset l ll lll llll la laa &> /dev/null
# list files in dir.
l()
{
ls -lhvt --si --group-directories-first "$@"
}
# list all files in dir, incl. hidden files.
ll()
{
ls -lAhvt --si --group-directories-first "$@"
}
# list files in tree structure.
2023-11-25 21:33:13 +03:00
# usage: lll [DEPTH] [DIRS]
2023-08-08 16:24:15 +03:00
lll()
{
2023-11-25 21:33:13 +03:00
local IFS=$'\n'
2023-10-30 03:49:10 +03:00
local depth="${1}"
2023-11-25 21:33:13 +03:00
local target=("${@:2}")
2023-08-08 16:24:15 +03:00
2023-11-25 21:33:13 +03:00
[[ "${target}" = "" ]] && target="."
[[ "${depth}" = "" ]] && depth=666
[[ "${depth}" = "-" ]] && depth=666
2023-08-08 16:24:15 +03:00
2023-11-25 21:33:13 +03:00
tree -a -L "${depth}" -- "${target[@]}"
2023-08-08 16:24:15 +03:00
}
# list files recursively.
llll()
{
ls -RlAhvt --si --group-directories-first "$@"
}
# list files alphabetically.
la()
{
ls -lh --si --group-directories-first "$@"
}
# list all files alphabetically.
laa()
{
ls -lAh --si --group-directories-first "$@"
}
# export.
2023-10-23 01:00:15 +03:00
export -f l ll lll llll la laa