Live data from Hacker News

Ask HN: How can I get better at bash?

news.ycombinator.com

141–150 of 195 posts

Re: Ask HN: How can I get better at bash?

#142

Set your default shell to bash, and every time something annoys you, look up how to fix it (stack overflow is basically complete at this point, if you know what to search for) and put it in your dotfiles. I used to rely on fish, but after a couple of bugs (either in fish or my fingers, not sure) I switched back to bash at my job (on a Linux desktop). After a few months I had built up a good set of aliases and functio…

[deleted]

Re: Ask HN: How can I get better at bash?

#143
post #129
post #101

As silly as it sounds, when I was a new Unix SysAdmin, I read the entirety of "man 1 bash", which includes all bash builtins. I found that it improved by bash-foo 100x simply by knowing about so many of the utilities. I also took some cliff notes for things that seemed generally useful. I did it for an hour or so a night for a week or so. That being said, a few of my personal favorites to memorize: * Parameter expans…

Also CTRL-_ which is "undo whatever you just typed"

pressing CTRL-w a few times feels easier to me, less awkward key combination

Re: Ask HN: How can I get better at bash?

#144

Set your default shell to bash, and every time something annoys you, look up how to fix it (stack overflow is basically complete at this point, if you know what to search for) and put it in your dotfiles. I used to rely on fish, but after a couple of bugs (either in fish or my fingers, not sure) I switched back to bash at my job (on a Linux desktop). After a few months I had built up a good set of aliases and functio…

I can recommend tools called Silver Searcher and/or RipGrep for text searching.

  https://github.com/ggreer/the_silver_searcher
  https://github.com/BurntSushi/ripgrep

Re: Ask HN: How can I get better at bash?

#146

If you're not already familiar with it, I would suggest learning about the basic Unix process model -- fork, execve, wait, open, pipe, dup2 and friends. Bash is essentially a DSL for these. A lot of the weirdness you see in the language is due to these abstractions leaking through. For example: * Quoting is building execve's argv parameter. It's hard to quote correctly if you don't know what exactly you're working to…

What is a good learning resource for what the basic Unix process model (i.e. what you are describing?)

Do you recommend a book or something like that? And preferably for a beginner?

Re: Ask HN: How can I get better at bash?

#149

From a 14+ year Linux/Unix admin: Get a very brief reference book of every common UNIX command. Read all the commands, what they do, what options they take. Start using them. Shells are most useful when they are used to tie together other programs. In order to do this, you have to know what all the command-line tools you have at your disposal are. Learn the tools, then start writing examples using them. Keep the exam…

"(and 'links -g' provides a graphical browser if you need images)"

Without X presumably needs framebuffer or something?

Post reply on HN