☢ u2622.ca

Meteor tips, help and sometimes random things

Screencast: Using Shell History to Create Aliases

| Comments

Contents:

  1. Introduction to aliases @ 0:00
  2. Analysing shell history to create relevant aliases @ 4:43

Download: mov 24MB, 8:26 (Recommended)

Watch (recommended in full screen and in HD):

Notes:

Make an alias:

1
2
alias l="ls -al"
alias glog="git log"

Add those to your ~/.aliasrc.

Modify ~/.zshrc or ~/.bashrc (works for both):

1
2
3
if [[ -r ~/.aliasrc ]]; then
  source ~/.aliasrc
fi

View shell history: history

View count of common commands:

1
2
history | awk '{ print $2 }' | sort | uniq -c | sort -n
history | awk '{ print $2,$3 }' | sort | uniq -c | sort -n

Use that output to create better aliases!

Here’s some of my favourite aliases:

1
2
3
4
5
6
7
8
9
10
11
12
13
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../../'
alias .....='cd ../../../../'
alias be='bundle exec'
alias g=git
alias ga='git add'
alias gc='git commit -v'
alias gca='git commit -v -a'
alias gch='git checkout'
alias gl='git pull'
alias gst='git status'
alias l='ls -al'

Comments