News for hackers. Stuff that matters.
Re:Mastering Bash and Terminal (2017) by blockloop on Friday December 10, 2021 @09:23PM (#29517829)
I'm glad to see this has aged well and still provides value. I plan to write V2 sometime in the near future.
Re:Mastering Bash and Terminal (2017) by dang on Friday December 10, 2021 @12:19AM (#29506679)
Discussed at the time:

Mastering Bash and Terminal - https://news.ycombinator.com/item?id=13400350 - Jan 2017 (180 comments)

Re:Mastering Bash and Terminal (2017) by PeterWhittaker on Friday December 10, 2021 @05:42PM (#29516368)
About two years ago, a change in work caused me to become a heavy git user. One of the most important changes I made to my bash setup was to change my prompt to multi line, detect whether I was in a git repo, include the branch in the prompt, and also include a summary of git status.

Very handy! (The check also makes sure I am in the repo part of the repo, and not, say, in its .git folder or other non-working folders.)

Re:Mastering Bash and Terminal (2017) by heavyset_go on Friday December 10, 2021 @07:16PM (#29517119)
> One of the most important changes I made to my bash setup was to change my prompt to multi line, detect whether I was in a git repo, include the branch in the prompt, and also include a summary of git status.

Check out starship[1] if you haven't already. It's a prompt that does just this and more, and works across shells like Bash, fish, zsh, etc.

[1] https://github.com/starship/starship

Re:Mastering Bash and Terminal (2017) by PeterWhittaker on Friday December 10, 2021 @07:23PM (#29517169)
Thanks! I will definitely check that out!
Re:Mastering Bash and Terminal (2017) by agustif on Friday December 10, 2021 @06:17PM (#29516650)
If you want all this and some more without setting it up yourself, oh-my-zsh spaceship prompt theme is great...

I don't feel at home at a terminal without it by now, so one of my first installs after brew ;-)

https://github.com/spaceship-prompt/spaceship-prompt

Re:Mastering Bash and Terminal (2017) by noahtallen on Saturday December 11, 2021 @12:13AM (#29518631)
My favorite for this purpose is pure prompt: https://github.com/sindresorhus/pure

I wasn’t sure about multi line at first, but really digging it now.

Re:Mastering Bash and Terminal (2017) by GloriousKoji on Friday December 10, 2021 @04:06PM (#29515456)
I know zsh has all the new fancy stuff but keeping the bash shell as default for macOS would have made my life just a little bit easier.
Re:Mastering Bash and Terminal (2017) by e40 on Friday December 10, 2021 @04:11PM (#29515493)
Thankfully you can change it. First thing I do when setting up a new mac: install Homebrew and change my shell to the bash that comes in Homebrew.
Re:Mastering Bash and Terminal (2017) by klysm on Friday December 10, 2021 @05:25PM (#29516197)
Surprised not to see a mention of “!!” here, I use that a decent amount
Re:Mastering Bash and Terminal (2017) by blockloop on Friday December 10, 2021 @09:21PM (#29517817)
That's one I forgot to mention but I do use it a lot. I don't know if you know this but you can also do a substitution on the previous command. I often do something like `ssh root@proxmox01` and then `!!:s/1/2` which runs it again, but substitutes 1 for 2 and executes `ssh root@proxmox02`.

edit: I realize that example fails the speed test vs `ctrl+p, backspace, 2, enter`, but hopefully you can see the value.

Re:Mastering Bash and Terminal (2017) by sceadu on Saturday December 11, 2021 @01:31AM (#29518969)
could that just be shortened down to ^1^2?
Re:Mastering Bash and Terminal (2017) by Zababa on Friday December 10, 2021 @05:51PM (#29516461)
I use "sudo !!" all the time, it's really useful.