commit 858718f9924660613c79e7e8c2f00bc476398ddc
parent 667aaa334c1713439bcbdbb634b0ed514d4130d1
Author: Alex Balgavy <alex@balgavy.eu>
Date: Thu, 24 Jun 2021 21:30:42 +0200
shell: some aliases/functions
Diffstat:
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/shell/aliases b/shell/aliases
@@ -10,7 +10,7 @@ alias l="command ls -lah"
alias ll="command ls -FGlAhpO@" # Ls but show everything you can
alias l.="command ls -a | grep '^\.'" # Ls but only dotfiles
alias less='less -iRXc' # Search ig case, fix ANSI colors, don't send init strings, clear screen
-alias du="du -skh" # Show entry for each file, show block counts in 1kb blocks, human-readable sizes
+alias du="du -sh" # Show entry for each file, human-readable sizes
alias df="df -h" # Show human-readable sizes
alias bc="bc -ql" # Don't print welcome message, use the standard math lib
alias jobs="jobs -l" # Show everything including PIDs
diff --git a/shell/functions b/shell/functions
@@ -142,4 +142,21 @@ if [ -d ~/.config/fzf ]; then
rj() {
fzf --preview "cat $1 | jq {q}"
}
+
+ # list man pages
+ mans() {
+ sec="${1:-1|4}"
+ # (sorry, couldn't be arsed to deal with escaping parentheses for variable passing in awk)
+ manlist=$(man -k . 2>/dev/null | awk "$(printf 'BEGIN {FS=OFS="- "} /\([%s]\)/ {gsub(/\([0-9]\)/, "", $1); if (!seen[$0]++) { print }}' "$sec")" | fzf) \
+ && man "$(echo "$manlist" | awk -F' |,' '{print $1}')" \
+ && unset manlist
+ }
+
+ # list env variables
+ envs() {
+ var=$(printenv | cut -d= -f1 | fzf) \
+ && echo "$var=$(printenv "$var")" \
+ && unset var
+ }
+
fi