Hacker News new | past | comments | ask | show | jobs | submit login

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/.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/clean... -- added via bash/zsh hooks.




> 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/ [2]: https://github.com/popstas/zsh-command-time


Hm, I didn't know about that. Thanks. Though, I use bash mostly.


why 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...


Because 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/clean... for more reasoning.


zsh, HISTORY_IGNORE is a regex what are you talking about... and there is history_ignore_all_dups so I'm really not following...


Not in bash. Like I said, I use bash (and sometimes ZSH)




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: