←back to thread

457 points benoitg | 6 comments | | HN request time: 1.428s | source | bottom
Show context
hiAndrewQuinn ◴[] No.44365512[source]
I like maximalist prompts, and indeed Starship is what Shell Bling Ubuntu [1] installs on a new dev machine. But they're not everyone's cup of tea.

If I wanted to recommend to someone the min-maxed, highest density thing they could add to their prompt, it would simply be the time your current prompt appeared + the amount of time the last command you ran took.

These two pieces of information together make it very easy for you (or your local sysadmin (or an LLM looking over your digital shoulder)) to piece together a log of exactly what happened when. This kind of psuedo-non-repudiation can be invaluable for debugging sessions when you least expect it.

This was a tip I distilled from Michael W. Lucas's Networking for System Administrators a few years ago, which remains my preferred recommendation for any developers looking to learn just enough about networking to not feel totally lost when talking to an actual network engineer.

Bonus nerd points if you measure time in seconds since the UNIX epoch. Very easy and fast to run time delta calculations if you do that:

    [0 1719242840] $ echo "foo"
    [0 1719242905] $ echo "fell asleep before hitting enter" && sleep 5
    [5 1719242910] $
[1]: https://github.com/hiAndrewQuinn/shell-bling-ubuntu
replies(6): >>44365588 #>>44366612 #>>44367092 #>>44368319 #>>44369209 #>>44369984 #
skydhash ◴[] No.44365588[source]
For personal workstation, the current directory is enough. Maybe I change the color based the status of the last command. That’s pretty much the only information I need before entering any command. Everything else can be accessed when I really need it.
replies(3): >>44365629 #>>44365734 #>>44365877 #
meesles ◴[] No.44365877[source]
Problem is you can't get timestamps and run times of your commands 'when you really need it', unlike almost everything else
replies(4): >>44365985 #>>44366544 #>>44366632 #>>44367249 #
bayindirh ◴[] No.44365985[source]
Why the timestamps are that important? Honestly asking.

You can always time your commands with "time".

replies(2): >>44366033 #>>44366052 #
1. stirfish ◴[] No.44366033[source]
I 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.
replies(1): >>44366109 #
2. bayindirh ◴[] No.44366109[source]
I 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).
replies(1): >>44367373 #
3. stirfish ◴[] No.44367373[source]
I 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

replies(1): >>44387404 #
4. bayindirh ◴[] No.44387404{3}[source]
Thanks for sharing the bell. I'll take a look. If you want to try push notifications, I use https://pushover.net as a service.

I developed the tool myself, and it's at 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 which also can be integrated with cURL.

replies(1): >>44387728 #
5. stirfish ◴[] No.44387728{4}[source]
This is incredibly helpful, thank you. I had no idea push notifications was something I could self-host.
replies(1): >>44387832 #
6. bayindirh ◴[] No.44387832{5}[source]
You're absolutely welcome. Me neither. If I could find ntfy.sh earlier, I'd have written nudge for it, not for Pushover.