Automating Most Frequently Used Commands

I’ve been desperately trying to create more time, and naturally I decided to do an analysis of, among other things, how I spend my time on the terminal… the premise here being that automation will inevitably result in more time. It’s mad I know, but that’s what desperate people do –they do crazy things. I increased buffer size for history file on three (3) machines I access frequently, got frequencies of top 20 commands across all machines and have thus began automating candidate tasks.

I put the entries below in my .bashrc file and took note of the top 20 commands I used the most in the last 24 hours (see plot)

# persist history commands
export HISTCONTROL=ignoredups:erasedups  # duplicate entries
export HISTSIZE=100000                   # history size
export HISTFILESIZE=100000               # history size
shopt -s histappend                      # append to history
export HISTTIMEFORMAT="%d/%m/%y %T "

# Save and reload the history after each command finishes
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
Most Frequently Used Commands

Most Frequently Used Commands

Here’s what I’ve done so far…

R, latex& dvipdf

I ditched R base graphics for ggplot2 and it takes insanely long; that coupled with the ‘latex -> dvipdf’ cycles to get output pdf file made these commands prime candidates for automation… so I created the make file below.

phiri-thesis.pdf : phiri-thesis.dvi
	dvipdf phiri-thesis.dvi

phiri-thesis.dvi : phiri-thesis.tex
	latex phiri-thesis.tex

phiri-thesis.tex : phiri-thesis.bib
	latex phiri-thesis.tex
	bibtex phiri-thesis
	latex phiri-thesis.tex

ssh, git, sudo

ssh: Periodic ‘write failed: Broken pipe‎’ meant re-executing ssh commands everytime connection broke; so I put a ‘ClientAliveInterval 120’ entry in /etc/ssh/ssh_config
git: I push, fetch and pull periodically; connection to my github account especially takes long –I’ve a script that does this automatically now
sudo: I made changes via ‘visudo’ to stop myself from issuing sudo everytime I needed superuser previlleges for certain commands..

I’ll replicate this for a whole week so I have a comprehensive picture of what else I can automate…



Categories: Technical
Tags: ,