gadgeteerza

Basic Bashrc for my servers

Oct 26th, 2022 (edited)
373
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.09 KB | Source Code | 0 0
  1. #
  2. # ~/.bashrc
  3. #
  4.  
  5. # Use bash-completion, if available, with <TAB> <TAB> - from https://github.com/scop/bash-completion
  6. [[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \
  7.     . /usr/share/bash-completion/bash_completion
  8.  
  9. alias cp="cp -i"                          # confirm before overwriting something
  10. alias df='df -h'                          # human-readable sizes
  11. alias free='free -m'                      # show sizes in MB
  12. alias np='nano -w PKGBUILD'
  13. alias more=less
  14. alias ping='ping -c 10'
  15. alias less='less -R'
  16. alias cls='clear'
  17.  
  18. # Show system stats
  19. alias stats='neofetch'
  20.  
  21. # Change directory aliases
  22. alias home='cd ~'
  23. alias cd..='cd ..'
  24. alias ..='cd ..'
  25. alias ...='cd ../..'
  26. alias ....='cd ../../..'
  27. alias .....='cd ../../../..'
  28.  
  29. # Directory listings
  30. alias lsall='exa -l --all --icons --group-directories-first --header'
  31. alias lsdir='exa --tree --only-dirs --level=3'
  32. alias ls='ls -g --group-directories-first --color=auto'  # Default if ls used
  33.  
  34. # Directory space usage
  35. alias space='ncdu -x --exclude /run/media --color dark /'
  36.  
  37. # Search command line history then i=use !no to execute line no
  38. alias h="history|grep "
  39.  
  40. # Search running processes
  41. alias p="ps aux|grep "
  42. alias topcpu="/bin/ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10"
  43.  
  44. # Count all files (recursively) in the current folder
  45. alias countfiles="for t in files links directories; do echo \`find . -type \${t:0:1} | wc -l\` \$t; done 2> /dev/null"
  46.  
  47. # Show current network connections to the server
  48. alias ipview="netstat -anpl | grep :80 | awk {'print \$5'} | cut -d\":\" -f1 | sort | uniq -c | sort -n | sed -e 's/^ *//' -e 's/ *\$//'"
  49.  
  50. # Show all logs in /var/log
  51. alias logs="sudo find /var/log -type f -exec file {} \; | grep 'text' | cut -d' ' -f1 | sed -e's/:$//g' | grep -v '[0-9]$' | xargs tail -f"
  52.  
  53. # Enable history appending instead of overwriting.  #139609
  54. shopt -s histappend
  55. # Ignore duplicates for History
  56. export HISTCONTROL=ignoredups
  57.  
  58. # Run Autojump folder navigation with letter 'j'
  59. . /usr/share/autojump/autojump.bash
  60.  
  61. # Run starship command prompt
  62. eval "$(starship init bash)"
  63.  
Tags: BASH bashrc
Advertisement
Comments
Add Comment
Please, Sign In to add comment