https://github.com/xta/bashhistorycount
Counts occurrences of ~/.bash_history and puts results in desc order
https://github.com/xta/bashhistorycount
Last synced: about 19 hours ago
JSON representation
Counts occurrences of ~/.bash_history and puts results in desc order
- Host: GitHub
- URL: https://github.com/xta/bashhistorycount
- Owner: xta
- Created: 2012-10-18T03:21:58.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-10-25T04:11:28.000Z (over 13 years ago)
- Last Synced: 2025-01-17T08:45:12.968Z (over 1 year ago)
- Language: Ruby
- Size: 117 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bash History Count
## by @rexfeng 2012
A simple ruby script that looks through ~500 lines of your ~/.bash_history file. Counts occurrences of Bash commands and puts results in desc order.
# possible uses of this:
* stats of bash commands over time (requires backing up .bash_history over time)
* advice on what shortcuts to implement in .bash_profile based on what commands you enter too much
# Instructions to Automate Backup of .bash_history in OS X with Crontab
1. Create a local script that creates the task of copying your ~/.bash_history (an example in script/.backup_bash_history.sh).
* You need to rename "~/backup/dir/goes/here/foryour" to your desired backup directory.
2. Setup recurring Crontab task to run .backup_bash_history at specified times.
* In Terminal, type "crontab -e"
* Press "i" to get into Insert Mode.
* Type in the following "0 */6 * * * ~/.backup_bash_history.sh" where "~/.backup_bash_history.sh" matches the correct path.
* Press the escape key to exit out of Insert Mode.
* You may either type ":wq" (to save and exit) or ":q!" (to exit without saving) followed by enter to submit your command.
3. Congratulations, based on your "crontab -e" setup, your ~/.bash_history will be backed up to the location specified in .bash_backup_history.sh (assuming your computer is on when crontab requires it).