How do I start learning Bash scripting?

Hey, when i was on the internet today i was looking on site about the Linux terminal (bash). and they were talking about shell scripting via .bashrc, how do you do it? I would really like to learn about shell scripting in my new Linux machine, and i want to be more productive with Linux and getting more familiar with it. (And the shell too).

Thank you for reading this post. :D

I don't know of any good tutorials for bash scripting as I took the approach of "I have this problem and I need to solve it" and done research on my specific problem and see how it could be done in bash.

I found that StackOverflow and Unix&Linux to be very useful resources for general programming and bash related questions as it is highly likely that the question you are looking for has already been answered with multiple solutions.

1 Like

I've learnt a fair deal of bash during my current arch linux installation. Mainly stuff like reading values from files (battery percentage) and acting thereafter but also making aliases for my most used commands (x instead of "startx && clear").

It's a good way to both learn and test your abilities to configure your terminal more deeply. Try moving everything into the terminal on an spare computer or vm and get used to bash. You'll soon find some scripts you want. (Or perhaps you could write some program in c that solves that problem)

2 Likes

Like @sidju said force yourself to use bash get something like a raspberry pi and run it headless ( no screen) that will force you to SSH into it. Everything I have learned has been from just Googling it. FYI bash_rc (or bash_profile same thing depending on Linux version) are king of your personalised settings so you can have commands that you run lots reduced in size. For example you may put 'pi' to run the command to login to your pi using SSH. I still look up commands on a daily basis so don't expect to remember it all. Good luck!

1 Like

If you want to figure things out yourself, rather than just copy pasting from stack exchange. Which is also OK, we've all done it.

GNU Bash manual:

https://www.gnu.org/software/bash/manual/bash.pdf

1 Like

Hi,

There is a How-to and it's foss has a Bash-challenge, which showcases "weird" behavior of bash scripts.

1 Like

http://www.bash.academy/
https://learnxinyminutes.com/docs/bash/

1 Like