4 ms·
Problem is you can't get timestamps and run times of your commands 'when you really need it', unlike almost everything else
by BowBun 1y ago
Problem is you can't get timestamps and run times of your commands 'when you really need it', unlike almost everything else
- bayindirh 1y agoWhy the timestamps are that important? Honestly asking. You can always time your commands with "time".
- stirfish 1y agoI personally use a modified zbell (in zsh) to give me a notification when a command finishes after 30 seconds, and send me an email if it takes over 2 minutes.
- bayindirh 1y agoI generally use Konsole's "notify when program exits" feature. For longer tasks, I have a small tool which I pipe to, and it sends me push notification with the output (if I prefer).
- stirfish 1y agoI had a tool I'd pipe to, but I'd often only think about it after I'd realize that the command was going to take a while. A push notification sound cool; I used email because I knew how to hack it together with curl. Here's one zbell implementation, not sure it's the original but it looks like it does the trick: https://gist.github.com/oknowton/8346801 https://gist.github.com/oknowton/8346801
- bayindirh 1y agoThanks for sharing the bell. I'll take a look. If you want to try push notifications, I use https://pushover.net https://pushover.net as a service. I developed the tool myself, and it's at https://git.sr.ht/~bayindirh/nudge https://git.sr.ht/~bayindirh/nudge if you feel like checking it out. If you want to host the whole push notification infrastructure, you can look at https://ntfy.sh https://ntfy.sh which also can be integrated with cURL.
- bertmuthalaly 1y agoWhen you’re debugging, especially a complex system, especially during an outage or postmortem, understanding when your commands executed relative to when your log lines appeared is really helpful.
- bayindirh 1y agoOh, that's an interesting use case, alright.
- styluss 1y agosounds like your describing https://linux.die.net/man/1/ts https://linux.die.net/man/1/ts
- kccqzy 1y agoThat's a poor and hacky substitute of using Linux audit features. It's perhaps the right robustness/complexity trade off for my personal machine, but for work they likely already have audit features turned on and you can access the timing from there.
- hiAndrewQuinn 1y agoI think you need to put a number on "likely", here. 80% of all workplaces, maybe? Even that seems a little high. There are a surprising number of devs who have never even heard of auditd. It's just not the kind of thing most people come across in their day to day work unless they go digging for it, or come from a security or DevOps background or something.
- xorcist 1y agoThat's a good reason to have timestamps in the history, which you should. Something like export HISTFILESIZE= export HISTSIZE= export HISTTIMEFORMAT="[%F %T] " shopt -s histappend really ought to be default in bash. It's not as clear why you need it in the interactive prompt.
- hiAndrewQuinn 1y ago
- horsawlarway 1y agoFor a personal workstation - you should never "really need it". It's a personal machine and should be treated as disposable. Doing anything less is fairly irresponsible. So sure - turn on timestamps for your ssh bastion (although it should be in the logs already...), or turn them on for the ci/cd pipeline (not that you should need them there anyways, since it should be dumping tons of timing info already). But a personal machine? Plain ol' ">" is plenty. Not that there's anything wrong with a maximal prompt either... I've definitely done the "configure all the powerline settings!" thing. But I also don't mind a simple ">" or "#".
- hiAndrewQuinn 1y agoWell, that's why you build it into the prompt. So you don't give yourself the opportunity to forget.
- mechanicum 1y agoAs an alternative, perennial HN recommendation atuin (https://atuin.sh https://atuin.sh) logs time, duration and exit code (among other data) for every command. That way you only have to look at it when you need it, and you can also figure out what you were doing last week/month/year if necessary.
- magarnicle 1y agoAfter mucking around for an hour trying to get this information into my prompt, I realised atuin already had it.