Last active
January 24, 2020 02:18
-
-
Save mak3r/2f804b0cb8bc4f686ab057815313e55b to your computer and use it in GitHub Desktop.
Capture the command history before moving between projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| #run this in all open terminals | |
| history -a | |
| # run this in the terminal where history (raw and sorted) is being captured | |
| history -a; history -c; history -r | |
| # capture the history to a file | |
| # because sometimes order of operations matters | |
| history > raw.hist | |
| # sort the history by command because sometimes | |
| # we are just looking for a form of a command | |
| cat raw.hist | sed 's/^[ 0-9]*[ ]*//g' | sort -s -u > sorted.hist | |
| # it would be interesting to implement a search | |
| # feature which allowed me to use a line found in | |
| # the sorted file and troll the raw file for pre-history | |
| # I think this command should be called 'big-history' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment