Memo‎ > ‎

My favorite BASH setup

posted May 6, 2014, 11:14 PM by Teng-Yok Lee   [ updated Jun 22, 2016, 1:53 PM ]
This is the combination of other memos:

REF: https://sites.google.com/site/recheliunew/memo/addthesupportofmatlab-stylebackwardhistorytobash
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e\e[C": forward-word
"\e\e[D": backward-word
"\e[1;3C": forward-word
"\e[1;3D": backward-word
REF: https://sites.google.com/site/recheliunew/memo/setupbashprompt
export PS1="\[\e[0;32m\][\u@leeten-ec2 \w] \[\e[0m\]\n$ "
Create ssh agent by default (REF: http://mah.everybody.org/docs/ssh)
SSHAGENT=/usr/bin/ssh-agent
SSHAGENTARGS="-s"
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then
  eval `$SSHAGENT $SSHAGENTARGS`
  trap "kill $SSH_AGENT_PID" 0
fi

Useful tips
  • Find the key mapping: Press Ctrl + V, and then the key combination of interest.
  • Re-read .inputc: Ctrl+x, and then Ctrl+r.
REF: http://superuser.com/questions/488157/how-do-i-make-ctrl-arrow-keys-move-forward-backward-a-word-at-a-time-in-cygwin-b
Comments