.bash_aliases 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. # _ _
  2. # ___| |_|___ ___ ___ ___
  3. # | .'| | | .'|_ -| -_|_ -|
  4. # |__,|_|_|__,|___|___|___|
  5. #
  6. # Colors in pacman and yay
  7. alias pacman='pacman --color=auto'
  8. alias yay='yay --color=auto'
  9. # More Vim aliases == better
  10. alias v='nvim'
  11. alias vi='nvim'
  12. alias vim='nvim'
  13. # Configure neovide as gvim alternative
  14. function gvim {
  15. nohup neovide --multiGrid --disowned $@ >/dev/null 2>&1 &
  16. }
  17. # some ls aliases
  18. alias ll='ls -alh --color=auto --group-directories-first'
  19. alias la='ls -Ah --color=auto --group-directories-first'
  20. alias l='ls -CFh --color=auto --group-directories-first'
  21. alias ls='ls -CFh --color=auto --group-directories-first'
  22. # cd stuff
  23. alias ..='cd ..'
  24. alias ...='cd ../..'
  25. # ripgrep > grep
  26. alias ogrep='/usr/bin/grep --color=auto -i' # keep original grep as ogrep
  27. # source: github.com/sharkdp/fd
  28. alias find='fd -H'
  29. # backup of original find
  30. alias ofind='/usr/bin/find'
  31. # cat on wings
  32. alias bat='bat --theme zenburn'
  33. # default image viewer
  34. alias img=sxiv
  35. # default markdown previewer
  36. alias md=markdown_previewer
  37. # default PDF viewer
  38. alias pdf='zathura --fork'
  39. # source: github.com/sharkdp/hexyl
  40. alias hex=hexyl
  41. # show open ports
  42. alias ports='ss -lust | column -t'
  43. alias netstat='netstat -tulanp'
  44. alias loadX='xrdb $HOME/.Xresources'
  45. alias zzz='systemctl suspend'
  46. alias ZZZ='systemctl hibernate'
  47. alias python-env="source $HOME/.scripts/misc/python-env"
  48. # brightness settings
  49. alias blow='xbacklight -set 10'
  50. alias bmed='xbacklight -set 45'
  51. alias bhi='xbacklight -set 90'
  52. # cd shortcuts
  53. alias cdc='cd $HOME/documents/cloud'
  54. alias cdi='cd $HOME/.config/i3'
  55. alias cdd='cd $HOME/documents'
  56. alias cdD='cd $HOME/downloads'
  57. alias cdt='cd $HOME/documents/tools'
  58. # copy the current path to clipboard
  59. alias cpwd='xclip -selection clipboard -i <(pwd | tr -d "\n")'
  60. # copy the last command issued to the clipboard
  61. alias clc='fc -ln -1 | tr -d "\n" | sed "s/^\s*//g" | xclip -selection clipboard -i'
  62. alias fcd='cd $(fd -t d | fzf)'
  63. alias cdf='cd $(fd -t d | fzf)'
  64. # ipaddr
  65. alias ipa='ip --brief --color add'
  66. # pipe into ccopy --> clipboard
  67. alias ccopy='xclip -selection clipboard'
  68. alias cpy='xclip -selection clipboard'
  69. # IPS
  70. alias pubip="dig +short myip.opendns.com @resolver1.opendns.com"
  71. alias localip="ip a | grep -Eo 'inet (addr:)?([0-9]*\\.){3}[0-9]*' | grep -Eo '([0-9]*\\.){3}[0-9]*' | grep -v '127.0.0.1'"
  72. # search files with fzf and open them
  73. function sf {
  74. file=$(fzf --preview='head -n$LINES {}')
  75. [ "$file" != "" ] && $EDITOR $file
  76. }
  77. # Bash Function Snippets
  78. # process grep
  79. function pg {
  80. pgrep -fa "$1" | grep -E --color "$1"
  81. }
  82. # Fun
  83. alias makespongebob="python -c 'import sys; makeSpongebob = lambda x: \"\".join([i.upper() if c %2 ==0 else i for c,i in enumerate(x)]);print(makeSpongebob(sys.argv[1]))'"
  84. # Docker Aliases
  85. alias podshell="sudo podman run --rm -i -t --entrypoint=bash"
  86. function podshellhere() {
  87. dirname=${PWD##*/}
  88. sudo podman run --rm -it --entrypoint=bash -v `pwd`:/${dirname} -w /${dirname} "$@"
  89. }
  90. alias nginxhere="sudo podman run --rm -ti -p 80:80 -p 443:443 -v `pwd`:/srv/data swrzm/nginx"
  91. # Opening a SMB server in the same dir
  92. smbhere() {
  93. local sharename
  94. [[ -z $1 ]] && sharename="SHARE" || sharename=$1
  95. sudo podman run --rm -it -p 445:445 -v "${PWD}:/tmp/serve" swrzm/impacket smbserver.py -smb2support $sharename /tmp/serve
  96. }
  97. # Runner
  98. run() {
  99. nohup $@ 2>&1 > /dev/null
  100. }
  101. # ---[it sec stuff]--- #
  102. # Disassemble using objdump
  103. disas() {
  104. objdump -M intel -d $@
  105. }