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
883 B
Bash
Raw Normal View History

2023-08-08 16:24:15 +03:00
# unset possible system-defined aliases.
2023-11-30 01:45:48 +03:00
unalias l ll lll llll la lla &> /dev/null
unset l ll lll llll la lla &> /dev/null
2023-08-08 16:24:15 +03:00
# list files in dir.
l()
{
2023-11-30 01:45:48 +03:00
ls -lhv --si --group-directories-first "$@"
2023-08-08 16:24:15 +03:00
}
2023-11-30 01:45:48 +03:00
# list last modified files first.
2023-08-08 16:24:15 +03:00
ll()
{
2023-11-30 01:45:48 +03:00
ls -lhvtr --si "$@"
2023-08-08 16:24:15 +03:00
}
# 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()
{
2023-11-30 00:34:11 +03:00
ls -RlAhv --si --group-directories-first "$@"
2023-08-08 16:24:15 +03:00
}
2023-11-30 01:45:48 +03:00
# list all files in dir, incl. hidden files.
2023-08-08 16:24:15 +03:00
la()
{
2023-11-30 01:45:48 +03:00
ls -lAh --si --group-directories-first "$@"
2023-08-08 16:24:15 +03:00
}
2023-11-30 01:45:48 +03:00
# list all files in dir, incl. hidden files, sorted by mtime.
lla()
2023-08-08 16:24:15 +03:00
{
2023-11-30 01:45:48 +03:00
ls -lAhtr --si "$@"
2023-08-08 16:24:15 +03:00
}
# export.
2023-11-30 01:45:48 +03:00
export -f l ll lll llll la lla