Advertisement
dsuveges

.bashrc

Mar 19th, 2017
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.73 KB | None | 0 0
  1. PATH="$HOME/bin:$PATH"
  2.  
  3. # Enabling colors:
  4. alias less='less --RAW-CONTROL-CHARS'
  5. alias ls='ls '
  6. export TERM=xterm-color
  7.  
  8. # Useful aliases:
  9. alias ll='ls -lah'
  10. alias lsd='ls -alF | grep /$'
  11. alias findhere='find . | grep'
  12. alias folders='find . -maxdepth 1 -type d -print0 | xargs -0 du -sk | sort -rn'
  13. alias grep='grep --color=auto'
  14. alias mroe='more'
  15. alias gerp='grep'
  16.  
  17. # Setting up history:
  18. HISTSIZE=500000000 # Setting size of history file. To make sure it is sufficiently large.
  19. HISTFILESIZE=5000000000
  20. HISTCONTROL=ignoredups # Ignoring duplicates
  21. shopt -s histappend # Adding lines to history every time a console is closed:
  22. shopt -s cmdhist # Combine multiline commands into one in history
  23. export HISTIGNORE="&:ls:bg:fg:exit:cd:pwd:ll:findhere:folders"
  24.  
  25. # Setting up proper history scroll:
  26. bind '"^[[A":history-search-backward'
  27. bind '"^[[B":history-search-backward'
  28.  
  29. # Setting up PERL5LIB path:
  30. export PERL5LIB=$PERL5LIB:~/perl5/lib/perl5/
  31.  
  32. # Setting up prompt:
  33. export PS1="\[\e[1;30m\]\A \u@\h\[\e[m\]:\[\e[1;32m\]\W\[\e[m\]$ "
  34.  
  35. # Adding alias for remote ipython notebook:
  36. alias ssh='ssh -Y'
  37. function ipython_remote { ssh -N -f -L localhost:${1}:localhost:${1} ds26@${2}; }
  38. function ipython_kill {
  39.     if [[ -z ${1} ]]; then
  40.         echo "Port number is required! The following ports are active:"
  41.         ps -e | grep ssh | grep localhost | perl -lane '($p) = $_ =~ /\:localhost\:(\d+)/; ($h) = $_ =~ /@(\S+)/; print "Port $p on host $h"'
  42.     return 1;
  43.     fi
  44.     PID=$(ps -e | grep ssh | grep localhost:${1} | awk -F " " '{print $1}')
  45.     if [[ -z ${PID} ]]; then
  46.         echo "There is no ssh tunnel open on port ${1}."
  47.     fi
  48.     kill ${PID}
  49. }
  50.  
  51. # If the profile file won't be loaded by any chance:
  52. source ~/.profile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement