.bash_aliases 4.0 KB

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