Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/natethinks/jog
Simple script to print the last 10 commands you ran in the current directory
https://github.com/natethinks/jog
Last synced: 4 months ago
JSON representation
Simple script to print the last 10 commands you ran in the current directory
- Host: GitHub
- URL: https://github.com/natethinks/jog
- Owner: natethinks
- Created: 2020-05-10T05:03:09.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-20T21:37:21.000Z (about 1 year ago)
- Last Synced: 2024-07-31T17:22:35.998Z (7 months ago)
- Size: 7.81 KB
- Stars: 472
- Watchers: 2
- Forks: 9
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# jog
Print the last 10 commands you ran in the current directory

## Usage
1. Add this function to your `.zshrc`
```
function zshaddhistory() {
if [[ "${1}" != ${~HISTORY_IGNORE} ]]; then
echo "${1%%$'\n'}⋮${PWD} " >> ~/.zsh_history_ext
fi
}
```2. Download or copy the `jog` script from this repo and place it somewhere in your `$PATH`.
3. Run `touch ~/.zsh_history_ext ; chmod 600 ~/.zsh_history_ext` to ensure that only you can read and write your history.
4. Restart your current terminal sessions for changes to take effect. `exec $SHELL`
5. Use `jog` whenever you find yourself lost and confused.
It's not possible to retroactively store the directory in which a command was run, so **this tool will only work from this point forward.**
## Todo List
Contributions and feature requests are welcome
- Add support for other shells: bash, fish.
- Automatically truncate `.zsh_history_ext` when `HISTSIZE` is surpassed