.bash_aliases 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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" | sed "s/^/\"/;s/$/\"/")'
  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. alias ipr='ip -color --brief route'
  78. # pipe into ccopy --> clipboard
  79. alias ccopy='xclip -selection clipboard'
  80. alias cpy='xclip -selection clipboard'
  81. # IPS
  82. alias pubip="curl -s ipinfo.io | jq -r '.ip'"
  83. 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'"
  84. # for weird manjaro stuff
  85. alias fixsudo="cat /etc/sudoers.d/10-installer"
  86. # search files with fzf and open them
  87. function sf {
  88. file=$(fzf --preview='head -n$LINES {}')
  89. [ "$file" != "" ] && $EDITOR $file
  90. }
  91. # Bash Function Snippets
  92. # process grep
  93. function pg {
  94. pgrep -fa "$1" | grep -E --color "$1"
  95. }
  96. # Fun
  97. 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]))'"
  98. # Docker Aliases
  99. alias podshell="sudo podman run --rm -i -t --entrypoint=/bin/sh"
  100. function podshellhere() {
  101. dirname=${PWD##*/}
  102. sudo podman run --rm -it --entrypoint=/bin/sh -v `pwd`:/${dirname} -w /${dirname} "$@"
  103. }
  104. alias nginxhere="sudo podman run --rm -ti -p 80:80 -p 443:443 -v `pwd`:/srv/data swrzm/nginx"
  105. # Opening a SMB server in the same dir
  106. smbhere() {
  107. local sharename
  108. [[ -z $1 ]] && sharename="SHARE" || sharename=$1
  109. sudo podman run --rm -it -p 445:445 -v "${PWD}:/tmp/serve" swrzm/impacket smbserver.py -smb2support $sharename /tmp/serve
  110. }
  111. # Runner
  112. run() {
  113. nohup $@ & 2>&1 > /dev/null
  114. }
  115. # ---[it sec stuff]--- #
  116. # Disassemble using objdump
  117. disas() {
  118. objdump -M intel -d $@
  119. }