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

55 lines
1.2 KiB
Bash
Raw Normal View History

2023-12-07 04:02:47 +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
2023-12-07 04:02:47 +03:00
# List files in dirs.
# Current dir by default.
# Usage: l [DIRS]
2023-12-07 01:44:42 +03:00
function l() {
2023-12-07 04:02:47 +03:00
ls -lhv --si --group-directories-first -- "$@"
2023-08-08 16:24:15 +03:00
}
2023-12-07 04:02:47 +03:00
# List last modified files first.
# Current dir by default.
# Usage: ll [DIRS]
2023-12-07 01:44:42 +03:00
function ll() {
2023-12-07 04:02:47 +03:00
ls -lhvtr --si -- "$@"
2023-08-08 16:24:15 +03:00
}
2023-12-07 04:02:47 +03:00
# List files in tree structure.
# Current dir by default.
# Depth can be omitted by passing - (dash).
# Usage: lll [DEPTH] [DIRS]
2023-12-07 01:44:42 +03:00
function lll() {
2023-12-05 21:50:45 +03:00
local IFS=$'\n'
local depth="${1}"
local target=("${@:2}")
2023-08-08 16:24:15 +03:00
2023-12-05 21:50:45 +03:00
[[ "${target}" = "" ]] && target="."
[[ "${depth}" = "" ]] && depth=666
[[ "${depth}" = "-" ]] && depth=666
2023-08-08 16:24:15 +03:00
2023-12-05 21:50:45 +03:00
tree -a -L "${depth}" -- "${target[@]}"
2023-08-08 16:24:15 +03:00
}
2023-12-07 04:02:47 +03:00
# List files recursively.
# Current dir by default.
# Usage: llll [DIRS]
2023-12-07 01:44:42 +03:00
function llll() {
2023-12-07 04:02:47 +03:00
ls -RlAhv --si --group-directories-first -- "$@"
2023-08-08 16:24:15 +03:00
}
2023-12-07 04:02:47 +03:00
# List all files in dirs, incl. hidden files.
# Current dir by default.
# Usage: la [DIRS]
2023-12-07 01:44:42 +03:00
function la() {
2023-12-07 04:02:47 +03:00
ls -lAh --si --group-directories-first -- "$@"
2023-08-08 16:24:15 +03:00
}
2023-12-07 04:02:47 +03:00
# List all files in dirs, incl. hidden files, sorted by mtime.
# Current dir by default.
# Usage: lla [DIRS]
2023-12-07 01:44:42 +03:00
function lla() {
2023-12-07 04:02:47 +03:00
ls -lAhtr --si -- "$@"
2023-08-08 16:24:15 +03:00
}