top | item 29483075

Mastering Bash and Terminal (2017)

70 points| gautamsomani | 4 years ago |blockloop.io | reply

13 comments

order
[+] blockloop|4 years ago|reply
I'm glad to see this has aged well and still provides value. I plan to write V2 sometime in the near future.
[+] PeterWhittaker|4 years ago|reply
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.)

[+] heavyset_go|4 years ago|reply
> 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

[+] GloriousKoji|4 years ago|reply
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.
[+] e40|4 years ago|reply
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.
[+] klysm|4 years ago|reply
Surprised not to see a mention of “!!” here, I use that a decent amount
[+] blockloop|4 years ago|reply
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.

[+] Zababa|4 years ago|reply
I use "sudo !!" all the time, it's really useful.