Skip to content

Instantly share code, notes, and snippets.

@CTimmerman
Last active May 5, 2021 10:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CTimmerman/5690283e54ad99bf100704a24209435b to your computer and use it in GitHub Desktop.
Save CTimmerman/5690283e54ad99bf100704a24209435b to your computer and use it in GitHub Desktop.
CLI shell settings for Bourne (sh), Bash, Z (zsh), etc.. ~/.profile seems common to all.
# .profile is used by both Bash and Zsh, .bash_profile only by Bash, and .bashrc by Bash but not on MacOS (no colors, for one).
export PATH="$(brew --prefix homebrew/php/php71)/bin:$PATH"
export CLICOLOR=1
export GREP_OPTIONS='--color=auto'
# Inherit prompt user@host:yellow path$
export PROMPT=$'%n@%m:\e[33m%c\e[0m%# ' # Zsh
export PS1='\[\a\]\t \u@\h:\[\e[93m\]\w\[\e[0m\]\$ ' # Bash. Use .bashrc on Debian.
ssh-add ~/.ssh/id_ed25519 # For GitLab key in Debian.
# Zsh doesn't see these in MacOS Sierra
alias d='diff -Bwurx ".*"'
alias ls='ls --color=auto'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias g='pcregrep -MHrn --color=auto'
mark(){ perl -pe 's/(.*ERR.*)/\x1b[93;41m$1\x1b[0m/i; s/(.*warn.*)/\x1b[93m$1\x1b[0m/i';} # less error.log |mark
@CTimmerman
Copy link
Author

$ cat logs.sh
cd /var/log/apache2
tail -f access.log error.log other_vhosts_access.log
$ ./logs.sh |grep -v notice |mark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment