Advertisement
gadgeteerza

Bashrc file

Oct 26th, 2022 (edited)
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.09 KB | Source Code | 0 0
  1. #
  2. # ~/.bashrc
  3. #
  4.  
  5. # If not running interactively (ie. from a script), don't do anything
  6. [[ $- != *i* ]] && return
  7.  
  8. # Use bash-completion, if available, with <TAB> <TAB> - from https://github.com/scop/bash-completion
  9. [[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \
  10.     . /usr/share/bash-completion/bash_completion
  11.  
  12. # Enable following line if bash completion not working for sudo commands
  13. # complete -cf sudo
  14.    
  15. # Change the window title of X terminals
  16. case ${TERM} in
  17.     xterm*|rxvt*|Eterm*|aterm|kterm|gnome*|interix|konsole*)
  18.         PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\007"'
  19.         ;;
  20.     screen*)
  21.         PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/\~}\033\\"'
  22.         ;;
  23. esac
  24.  
  25.  
  26. alias cp="cp -i"                          # confirm before overwriting something
  27. alias df='df -h'                          # human-readable sizes
  28. alias free='free -m'                      # show sizes in MB
  29. alias np='nano -w PKGBUILD'
  30. alias more=less
  31. alias ping='ping -c 10'
  32. alias less='less -R'
  33. alias cls='clear'
  34.  
  35. # Show system stats
  36. alias stats='neofetch'
  37.  
  38. # Change directory aliases
  39. alias home='cd ~'
  40. alias cd..='cd ..'
  41. alias ..='cd ..'
  42. alias ...='cd ../..'
  43. alias ....='cd ../../..'
  44. alias .....='cd ../../../..'
  45.  
  46. # Directory listings
  47. alias lsall='exa -l --all --icons --group-directories-first --header'
  48. alias lsdir='exa --tree --only-dirs --level=3'
  49. alias ls='ls -g --group-directories-first --color=auto'  # Default if ls used
  50.  
  51. # Directory space usage
  52. alias space='ncdu -x --exclude /run/media --color dark /'
  53.  
  54. # Search command line history then i=use !no to execute line no
  55. alias h="history|grep "
  56.  
  57. # Search running processes
  58. alias p="ps aux|grep "
  59. alias topcpu="/bin/ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10"
  60.  
  61. # Count all files (recursively) in the current folder
  62. alias countfiles="for t in files links directories; do echo \`find . -type \${t:0:1} | wc -l\` \$t; done 2> /dev/null"
  63.  
  64. # Show current network connections to the server
  65. alias ipview="netstat -anpl | grep :80 | awk {'print \$5'} | cut -d\":\" -f1 | sort | uniq -c | sort -n | sed -e 's/^ *//' -e 's/ *\$//'"
  66.  
  67. # Show all logs in /var/log
  68. 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"
  69.  
  70. # Allows local "root" user to connect to X server to run GUI apps
  71. xhost +local:root > /dev/null 2>&1
  72.  
  73. # Bash won't get SIGWINCH if another process is in the foreground.
  74. # Enable checkwinsize so that bash will check the terminal size when
  75. # it regains control.
  76. # http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
  77. shopt -s checkwinsize
  78.  
  79. shopt -s expand_aliases
  80.  
  81. # Enable history appending instead of overwriting.  #139609
  82. shopt -s histappend
  83. # Ignore duplicates for History
  84. export HISTCONTROL=ignoredups
  85.  
  86. # # ex - archive extractor
  87. # # usage: ex <file>
  88. ex ()
  89. {
  90.   if [ -f $1 ] ; then
  91.     case $1 in
  92.       *.tar.bz2)   tar xjf $1   ;;
  93.       *.tar.gz)    tar xzf $1   ;;
  94.       *.bz2)       bunzip2 $1   ;;
  95.       *.rar)       unrar x $1     ;;
  96.       *.gz)        gunzip $1    ;;
  97.       *.tar)       tar xf $1    ;;
  98.       *.tbz2)      tar xjf $1   ;;
  99.       *.tgz)       tar xzf $1   ;;
  100.       *.zip)       unzip $1     ;;
  101.       *.Z)         uncompress $1;;
  102.       *.7z)        7z x $1      ;;
  103.       *)           echo "'$1' cannot be extracted via ex()" ;;
  104.     esac
  105.   else
  106.     echo "'$1' is not a valid file"
  107.   fi
  108. }
  109.  
  110. # better yaourt colors
  111. YAOURT_COLORS="nb=1:pkg=1:ver=1;32:lver=1;45:installed=1;42:grp=1;34:od=1;41;5:votes=1;44:dsc=0:other=1;35"
  112.  
  113. export PATH="$PATH:/home/danie/.local/bin"
  114. export VISUAL="nano"
  115. export EDITOR="/usr/bin/nano"
  116. export QT_QPA_PLATFORMTHEME="qt5ct"
  117.  
  118. # Node Version Manager
  119. export NVM_DIR="$HOME/.nvm"
  120. [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
  121. [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
  122.  
  123. # Run Starship bash prompt - config file is ~/.config/starship.toml
  124. eval "$(starship init bash)"
  125.  
  126. # Run Autojump folder navigation with letter 'j'
  127. . /usr/share/autojump/autojump.bash
  128.  
Tags: BASH bashrc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement