7 ms·
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
by hiAndrewQuinn 1y ago
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 https://github.com/hiAndrewQuinn/shell-bling-ubuntu
- nine_k 1y agoCurrent time in a more human-readable format is very helpful sometimes. Also, the exit status of the previous command, if nonzero, is also very helpful when anything fails.
- skydhash 1y agoFor 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.
- hiAndrewQuinn 1y agoI 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.
- bayindirh 1y agoWhen starting to work on something, I generally do a sanity check to see that the fundamentals are there and correct versions, then throw that part of the context out of mind, knowing that I stand on firm ground. I found out that with this verify-and-forget step, I work much more efficiently. As a result, my workflow becomes independent of the machine I work on, because I become the tool, not my setup. After that point, only having a "$" at the beginning of the line is enough. Of course everyone have their own choices, and YMMV.
- bredren 1y agoYes. 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.
- JimDabell 1y agoHow 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.
- bredren 1y agoAll 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.
- acedTrex 1y agoYou don't need to know what branch you're on before running commands? I cant tell you the number of times ive been on the wrong branch executing stuff.
- zikduruqe 1y agoFor me the AWS integration is nice. That way I know what account I'm on, and what region among my dozens of windows. For example: …/.config master on AWS_Prod (use2) starship.toml: [aws] format = 'on [($profile )(\($region\) )]($style)' style = 'bold #B23D2F' symbol = " " <- cloud symbol [aws.region_aliases] us-east-1 = 'use1' us-east-2 = 'use2'
- acedTrex 1y agoOh ya, for work the kubeconfig integration is absolutely essential, i bounce between local clusters and shared nonprod clusters all the time and while its not an outage to break the nonprods its going to annoy a lot of people so its nice to know which one is active.
- alganet 1y agoI literally use just PS1='$ '. `git status` to know git stuff. `pwd` for the current working directory, etc I also don't use aliases like `gs` or `..` One good thing about having a very minimal setup is that you feel at home anywhere. It wasn't always like this. I used many, many prompts and shell tools over the decades. The only tool that stood the test of time is tmux.
- horsawlarway 1y agoSame here. I definitely went through a powerline, alias, huge vimrc, etc phase, but it turns out just sticking to the base toolset is pretty handy. I can sit down at (or ssh into) any machine and be basically just as productive, and it also turns out that I just always want to know more than nicely fits into the prompt anyways. There's something to be said for accepting the defaults of a tool, and learning to use them well. Customization is powerful, but... I think most times it's not the right call until you're already an expert in the tool at hand.
- BowBun 1y agoProblem 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.
- ljm 1y agoI never bothered configuring my prompt at all because, inside emacs, I could already see most of what I needed in the editor itself. In fact, I only set up Starship when I started to do more pairing. It wasn’t for my benefit as much as it was for those watching my screen and checking the work, especially when operating on prod and confirming what we wanted to run. I just load up a separate terminal app for that so I don’t have to walk people through my setup.
- andrewflnr 1y agoThe exit code of the last command is useful for similar reasons.
- MyOutfitIsVague 1y agonushell does that out of the box: > history | get 82076 ╭─────────────────┬──────────────────╮ │ start_timestamp │ 2025-06-24 16:46 │ │ command │ mpc play │ │ cwd │ /home/work │ │ duration │ 1ms │ │ exit_status │ 0 │ ╰─────────────────┴──────────────────╯ It's really nice, because it doesn't just tell you time between command executions (or rather time between commands finishing), but the actual runtime duration of the command.
- __MatrixMan__ 1y agoI love nushell. You can also query by friendlier things than index: history | where exit_status == 127 | last | get duration 2sec 410ms The syntax ends up very clean looking since the data going through the pipes is typed, and the error messages are top notch × Types 'duration' and 'int' are not compatible for the '-' operator. ╭─[entry #47:1:2] 1 │ (history | where exit_status == 127 | last | get duration) - 10 · ───┬─── ┬ ─┬ · │ │ ╰── int · │ ╰── does not operate between 'duration' and 'int' · ╰── duration ╰──── (fingers crossed hn doesn't mangle that...)
- layer8 1y agoYou could probably (I haven’t tested it) append the run time as a comment to the history using something like PROMPT_COMMAND and `history -r <(…)`, instead of cluttering the prompt with it. And the start time is already in the history, using HISTTIMEFORMAT.
- hiAndrewQuinn 1y agoPer the Bash `history` manpage: int history_write_timestamps If non-zero, timestamps are written to the history file, so they can be preserved between sessions. The default value is 0, [...] So this isn't true by default on many machines unless it is explicitly turned on. Once you do have it on, of course, then I agree.
- layer8 1y agoThat’s why I wrote “using HISTTIMEFORMAT”, which turns it on. It’s reasonably common to do that.
- bedlamite 1y agoThis is why I really appreciate tools like Atuin. It augments your history with extra data such as the working directory, exit code, time to run command.