←back to thread

457 points benoitg | 1 comments | | HN request time: 0.204s | source
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 #
hiAndrewQuinn ◴[] No.44365629[source]
I like stuffing everything which might be important to the context window in there, personally. Saving 50ms on the prompt load sure beats a false negative when something goes wrong because I don't even think to ask whether I have the wrong Node version installed or something.
replies(2): >>44365752 #>>44365875 #
bredren ◴[] No.44365875[source]
Yes. I show the python or node version of currently active venv and venv name.

Also, I somehow worked in special characters for Python and other things that get screwed up if I don’t have the right nerd font installed on the system.

replies(1): >>44366907 #
JimDabell ◴[] No.44366907[source]
How often are you switching these things that you need their values in sight at all times though?

Even for cases where I need to use old versions, I don’t need a reminder of that every time I run a command.

replies(1): >>44369787 #
1. bredren ◴[] No.44369787[source]
All of the time. Often I'm working with 3-4 different project contexts simultaneously.

It isn't that useful but I do glance it when I'm working on dependencies and to ensure the context between a terminal session and pycharm's interpreter match.

The information doesn't cloud the prompt for me though, as it is right justified and I don't really think about time to load, as the machines are relatively recent Apple Silicon.