Learn Shell Scripting

12-11-2021

Once I needed to move a huge number of files in a complex file structure to a single folder, the thought of moving everything manually popped up but I immediately rejected it as that would be impossible. At the time I was really starting to get good at javascript so I wrote a program in js to move the files I wanted. Needless to say the program was slow and was around 30 lines of code. After a few days I remembered that bash existed and that I could use it in this case. So I tried it and with a single mv command I accomplished what 30 lines of js code could in a fraction of the time. Since I moved to linux shell scripting is something I do regularly with a lot of enjoyment.

Currently a few notable scripts I have on my system are:

Many fear the command line and I get it, I was also afraid at the beginning but you sometimes have to reach past your comfort zone. The shell in general is extremely powerful if you are a programmer do learn it. Even if you are not, give it a try it might come in handy.

Some nice commands to start with: cat, sed, awk, tr, xargs

Disclaimer: I am talking about something like bash, the POSIX shell or zsh. I hate cmd and powershell from windows and I don't recommend them, if they suit you however, suite yourself.

Links