4 ms·
This is the feature I've been looking for: "log exit code, cwd, hostname, session, command duration, etc"
by ranting-moth 3y ago
This is the feature I've been looking for:
"log exit code, cwd, hostname, session, command duration, etc"
- pletnes 3y agoXonsh has this. It’s super cool after using it for a while.
- conradludgate 3y agoThere's a PR opened (that I still need to review...) that adds even more fields such as shell type and opt-in environment variables to this list. One day, you could search for that AWS cli command run specifically on AWS_ACCOUNT_ID=foo
- okasaki 3y agoyou can mostly do that in bash: export PROMPT_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date "+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >> ~/stuff/logs/bash-history-$(date "+%Y-%m-%d").log; fi' makes files like stuff/logs/bash-history-2023-05-06.log that contain 2023-05-06.11:42:38 /home/dv 3737 2023-05-06 11:42:38 cat .bashrc then you can make some commands to grep through this
- brasic 3y agoOr use the excellent bash-preexec plugin that atuin itself relies on to achieve this in a cleaner way: https://github.com/rcaloras/bash-preexec https://github.com/rcaloras/bash-preexec