contador web Skip to content

5 reasons to learn Shell Script and master Linux

Diolinux

It cannot be denied that Bash is one of the most widely used command interpreters in the world.

And it is not for nothing. Sometimes it is impossible to see the potential hidden behind Bash’s command line with the naked eye.

Just open the man page from Bash to see the world of possibilities (and even be a little impressed / scared).

If you’ve done our terminal course, you already had a small sample of the amount of things you can do on the command line (interactive mode).

However, it is very wrong to think that shell scripts only serve to automate backups and the like.

Below we will list 5 reasons to learn the art of shell scripting.

1 – Numerous parts of a linux distribution use shell scripts.

Shell Script

– Packaging systems (rpm and deb): scripts are used when creating packages, and even when installing (post installation scripts).

– Init systems (upstart, sysvinit): they need shell scripts to control services that run under the hood.

– Grub: Files that generate boot configurations are shell scripts: /etc/grub.d/

– xdg-open: command to open files automatically in the correct program, it is also a shell script.

We could spend hours here listing places and subsystems in a linux distribution that use shell scripts.

2 – New concepts, but the Shell Scripts are there

Shell Scripts on Drones?

It is amazing how time goes by, technologies evolve, computing concepts change, but shell scripts always appear somewhere.

Perhaps you have realized that what is most talked about today is about cloud computing.

Demand for new professionals who understand several different technologies appears, such as docker and openstack.

And despite the new concepts, still at the base, the shell script remains firm and strong.

– Docker: Within the file that defines a docker container you can use shell scripts.

– Openstack: You can run a script at the first boot of a virtual machine for customization.

3 – Understanding Shell Scripts improves your knowledge in interactive mode

Learning Shell Script

Bash can be run in basically two modes: interactive (command line) and non-interactive (scripts).

One of the most fascinating things in the world of command interpreters is the number of different ways to perform the same task.

Many people spend many years with a Swiss army knife in their hands, but try to do everything using only the simplest knife in the knife, as it is the only one they know how to open.

This pocket knife is Bash. When we go deeper into scripts and understand their structures for flow control, variables, etc., we are able to greatly optimize our time. Structures like the «for», and even functions, which are usually found only in scripts, can easily

be used directly from the command line in interactive mode. And that’s where the cat’s jump is.

Tasks like renaming multiple files in a directory at once can easily be done with a line like the following:

for i in *.txt; do mv $i ${i%%.txt}-old.txt; done # renomeia todos os arquivos .txt para arquivo-old.txt

4 – Improve your resume

Shell Script Curriculum

Anyone who wants to work professionally with Linux, that is, make their hobby a real profession, must necessarily master shell scripts. Regardless of the area you plan to work in (programming, network administration, systems administration) you will need to write and read other people’s scripts.

There are job offers that nowadays don’t even mention the requirement to know shell scripts because they already assume that the candidate knows.

5 – Shell script is fun

Shell Script is fun

Only technology lovers will understand this reason. But yes, the pleasure of automating tasks and seeing that script you created from scratch working on your own and being proud to see him doing what you used to do “by hand”… this inexplicable feeling is already reason enough to let go of everything you is doing and go running to learn shell scripts.

Of course there is a lot of material on the internet for you to research, handouts and everything, but as you have asked several times, we are going to launch a new course in EAD.

If you have no idea where to start and need a guide, stay tuned that a full Shell Script course will be launched soon at Diolinux’s EAD. Over 11 hours of video lessons explaining in detail everything you need to know to master the art automate tasks

and optimize your life on the command line.

This article was written in partnership with our professor Tiago Salem, he already has a Bash course (Terminal) at Diolinux EAD, this course is almost a prerequisite for the upcoming Shell course, it’s worth taking a look.

To the next!