til/Applications/Essential/Bash.md

861 B

Bash

Add to ~/.bashrc:

export HISTSIZE=10000
export HISTFILESIZE=10000
export HISTCONTROL=ignoreboth:erasedups
export HISTIGNORE="cd:ls:la:ll:pwd:exit"

shopt -s histappend

Shebang:

#!/usr/bin/env bash
Shorcut Explain
CTRL-A move to begining of line
CTRL-E move to end of line
CTRL-Right move forward a word
CTRL-Left move backward a word
CTRL-W clear the word behind

macOS

In macOS, Bash read ~/.bash_profile not ~/.bashrc, so edit ~/.bash_profile:

[[ -f ~/.bashrc ]] && \
    source ~/.bashrc

To use latest Bash, install bash with Homebrew. Then append to /etc/shells:

/usr/local/bin/bash

Set default shell

chsh -s /usr/local/bin/bash