4 ms·
I do something similar -- I show the duration of the command in a human readable format, but only if the command too more than 60 seconds; useful to get an idea
by naggie 6y ago
I do something similar -- I show the duration of the command in a human readable format, but only if the command too more than 60 seconds; useful to get an idea of how long compilations (etc) take
See https://github.com/naggie/dotfiles/blob/master/home/.functions.sh#L148 https://github.com/naggie/dotfiles/blob/master/home/.functio...
One of my most useful changes is a script that garbage-collects my history file: deduplication, removal of sensitive + trivial commands. In combination with a FZF based history search that's shared between all shells, I effectively have a super-quick database of every command without any noise. See https://github.com/naggie/dotfiles/blob/master/scripts/cleanup-history https://github.com/naggie/dotfiles/blob/master/scripts/clean... -- added via bash/zsh hooks.
- MachineGunPablo 6y agowhy would you write an own script to sanitize your history manually? that sounds crazy, you can disallow duplicates and blacklist specific commands using normal shell configuration...
- naggie 6y agoBecause HISTCONTROL=ignoredups only deduplicates sequential commands, and having my own script allows specification of the blacklist in a non-redundant way between zsh and bash. In addition, I can do it in such a way that the most recent invocation is deleted last. I can also use regexes. See https://github.com/naggie/dotfiles/blob/master/scripts/cleanup-history#L11 https://github.com/naggie/dotfiles/blob/master/scripts/clean... for more reasoning.
- MachineGunPablo 6y agozsh, HISTORY_IGNORE is a regex what are you talking about... and there is history_ignore_all_dups so I'm really not following...
- naggie 6y agoNot in bash. Like I said, I use bash (and sometimes ZSH)
- nikeee 6y ago> I show the duration of the command in a human readable format, but only if the command too more than 60 seconds There is also a similar builtin feature [1] of ZSH. For example, you can put this in your .zshrc: REPORTTIME=10 It instructs ZSH to report the time elapsed since the command was invoked (if it is above this threshold, 10 seconds in this case). However, it just takes the CPU time into account. When using something like `sleep`, it won't trigger. There is a plugin [2] that covers this use case aswell. [1]: https://nuclearsquid.com/writings/reporttime-in-zsh/ https://nuclearsquid.com/writings/reporttime-in-zsh/ [2]: https://github.com/popstas/zsh-command-time https://github.com/popstas/zsh-command-time
- naggie 6y agoHm, I didn't know about that. Thanks. Though, I use bash mostly.