.bash_aliases 3.6 KB

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