Skip to content

askedrelic/bash-history-punchcard

Repository files navigation

Punchcard Bash History

How I work at home (~3 years ago) Home usage

My current work machine (loving that 10-6) Work usage

Visualize when you are using bash (and hopefully getting work done).

Installation

Dependencies:

  • Python 2.6/2.7
  • the Bash HISTTIMEFORMAT variable to be set, so your bash usage is recorded in a useful manner

Install from PyPI via pip:

$ pip install bashpunchcard

Setup

Set these in your .bashrc or .bash_profile, and reopen your shell.

export HISTTIMEFORMAT='%Y-%m-%d %H:%M:%S - '
export HISTSIZE=50000

If you type some commands then do history, you should see your bash history with a line number, timestamp, and the command.

Usage

Once installed and once you have bash history to graph, you can run it from the command line:

$ bashpunchcard
Wrote new punchcard to /Users/askedrelic/historychart.png

$ bashpunchcard -h
usage: Command line script for creating a PNG punchcard graph of your bash history
    [-h] [-W WIDTH] [-H HEIGHT] [-2] [-s] [-t TITLE] [-c COLORS] [-i INPUT]
    [-o OUTPUT] [-v]

optional arguments:
-h, --help            show this help message and exit
-W WIDTH, --width WIDTH
                        chart width (default: 800)
-H HEIGHT, --height HEIGHT
                        chart height (default: 300)
-2, --24              24-hour clock
-s, --sunday          Sunday at top
-t TITLE, --title TITLE
                        chart title
-c COLORS, --colors COLORS
                        colors of days, top to bottom (default:
                        000000,000000,000000,000000,000000,000000,000000)
-i INPUT, --input INPUT
                        input filename (default:
                        /Users/mbehrens/.bash_history)
-o OUTPUT, --output OUTPUT
                        output image filename (default: historychart.png)
-v, --version         show program's version number and exit

Ideas and most code from:

License

MIT, See attached LICENSE

Related

About

Command line script for creating a PNG punchcard graph of your bash history.

Resources

License

Stars

Watchers

Forks

Packages

No packages published