Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
77 lines (71 sloc) 2.39 KB
### python
alias python="python3"
alias pip="pip3"
### coreutils
alias c="cat"
alias e="echo"
# alias s="less -S"
alias s="less"
alias ls="ls --color=auto"
alias l="ls -hl --color=auto"
alias lt="ls -hltr --color=auto"
alias ll="ls -al --color=auto"
alias tt="ls -1t | head"
alias cx='cd `ls -t | head -1`'
alias rr="rm -r"
alias r="readlink -m"
alias ct="column -t"
alias ch="chmod -R 755"
alias chh="chmod -R 644"
alias grep="grep --color"
# prevent mv from automatically replacing files
alias mv="mv -i"
alias yy="rsync -azv --progress"
# number lines alternative to nl
alias nn="awk '{print NR\"\t\"\$0}'"
# use with du -sh : find things in the gigabyte or terabyte range
alias gig="awk '\$1 ~ /G|T/'"
# translate newlines to commas
alias ma="tr '\n' ','"
# remove comments
alias sd="sed '/^#/d'"
# remove empty lines with white space
alias noempty="perl -ne '{print if not m/^(\s*)$/}'"
# replace spaces with underscores
alias u="tr ' ' '_'"
### awk
alias awkf="awk -F'\t'"
alias length="awk '{print length}'"
# notesappend, my favorite alias
alias n="history | tail -2 | head -1 | tr -s ' ' | cut -d' ' -f3- | awk '{print \"# \"\$0}' >> notes"
### HTML-related
alias htmlsed="sed 's|\&|\&amp\;|g; s|>|\&gt\;|g; s|<|\&lt\;|g;'"
### git
alias ga="git add"
# add only previously tracked files
alias gaa="git add -u"
alias gc="git commit -m"
alias gac="git commit -a -m"
alias gp="git pull"
alias gpush="git push"
alias gs="git status"
alias gl="git log"
alias gg="git log --oneline --decorate --graph --all"
# alias gg="git log --pretty=format:'%h %s %an' --graph"
# include author name:
alias ggg='git log --graph --pretty=format:"%Cred%h%x09%Creset%an%x09%ad%x09%Cgreen%s"'
alias gb="git branch"
alias gch="git checkout"
alias gls="git ls-files"
alias gd="git diff"
### bioinformatics
# useful for viewing files which have many columns in the terminal:
alias vv="sed '/^##/d' | column -t | less -S"
# ditto - but if columns contain spaces in fields, specify tab delimiter:
alias vvv="sed '/^##/d' | column -t -s' ' | less -S"
# count columns
alias colcount="awk -F'\t' '{if (NR==1) { for (i=1; i<=NF; i++) {printf i; for (j=1; j<=int(length(\$i)/8); j++) {printf \"\t\"}; if (i==NF) {printf \"\n\"} else {printf \"\t\"}}; print \$0 } else {print \$0}}'"
# combine colcount and vvv
alias cv="colcount | vvv"
# mesh together with colons the fields of two rows
alias dt="datamash transpose --no-strict | sed 's|\t|:|g' | tr '\n' '\t'; echo"