-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path03-aliases.zsh
executable file
·89 lines (75 loc) · 2.39 KB
/
03-aliases.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Reload zsh config
alias setup!="bash $DOTFILES_HOME/setup.sh"
alias stow!="cd ~/; bash $DOTFILES_HOME/setup-stow.sh; cd -"
alias reload!='RELOAD=1 source ~/.zshrc; mise reshim;'
alias redock!="bash $DOTFILES_HOME/setup-dock.sh"
# Default programs
function stree() {
echo "WARNING: use smerge instead"
force_learn_command "2024-03-01"
smerge "$@"
}
# Dotfiles
alias dot="cd $DOTFILES_HOME"
alias edot="$GUI_EDITOR $DOTFILES_HOME"
alias cdot="code $DOTFILES_HOME"
alias cfunc="subl $DOTFILES_HOME/zsh/dot-zsh/99-custom.zsh"
alias gdot="smerge $DOTFILES_HOME"
# Default options
alias mv="mv -i"
alias cp="cp -pi"
alias mkdir="mkdir -p"
alias rsync="rsync -vh"
alias json="json -c"
alias psgrep="psgrep -i"
alias df="df -H"
# folder helpers
alias l="ls -lFh"
alias ll="ls -lFh"
alias lla="ls -lAFh"
alias llr="ls -tRFh"
alias llt="ls -ltFh"
alias ldot="ls -ld .*"
# Navigation
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias -- -="cd -" # Go to previous dir with -
alias cd.='cd $(readlink -f .)' # Go to real dir (i.e. if current dir is linked)
# Reboot / Halt / Poweroff
alias reboot="sudo reboot"
alias poweroff="sudo poweroff"
alias halt="sudo halt"
alias shutdown="sudo shutdown"
# List declared aliases, functions, paths
alias aliases="alias | sed 's/=.*//'"
alias functions="declare -f | grep '^[a-z].* ()' | sed 's/{$//'"
alias paths='echo -e ${PATH//:/\\n}'
# Network
alias flushdns="sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder"
alias dnsflush="echo 'use flushdns' && flushdns"
function ip() {
local ip_address
if [[ $1 == "local" ]]; then
echo "local"
ip_address=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1')
else
ip_address=$(dig +short myip.opendns.com @resolver1.opendns.com)
fi
if [ -z "$ip_address" ]; then
echo "external using ipinfo.io"
ip_address=$(curl -s ipinfo.io | jq -r '.ip')
else
echo "external using myip.opendns.com"
fi
echo $ip_address
}
# Git
alias glog='git log --graph --pretty=format:"%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset" --abbrev-commit --date=relative'
alias gfa='git fetch --all --prune'
# Tmux
alias tls="tmux list-sessions"
# System
alias screenfetch="neofetch"
alias hdd="sudo hdparm -C /dev/sd[a-l]"