Skip to content
Start » Linux » Reasons Why Learn Bash/Shell (Command Line)

Reasons Why Learn Bash/Shell (Command Line)

Bash is a command line language (you know that black screen) for Unix-based operating systems like Linux. It allows you to control your computer using programmable commands. Whether you're a software developer or systems administrator, there are several reasons why learning Bash or Shell and getting the most out of the environment, through the command line, increases your productivity.

In addition to programmers and administrators, learning Bash is a valuable skill for data professionals. Don't worry, you don't have to be a hacker to use the terminal and program from the command line

What is Bash?

Briefly, Bash is the command line interface (CLI) of Unix, Linux, Centos. It is commonly referred to as a terminal, command line, or shell. It is a command language that allows us to work with files on our computers in a very efficient and often more powerful way than using a GUI (graphical user interface).

Making the switch from graphical user interfaces (GUIs) to a command-line interface can seem intimidating, but I assure you that it's a simple learning process and that in no time at all it starts to improve the productivity of professionals on a daily basis.

Next, I'll present a number of reasons to convince you that Bash is really worth learning:

1. Bash knowledge is popular and pays well

According to developer survey 2020 Stack Overflow, bash/shell/powershell (i.e., the Linux family of command-line language interpreters) is the sixth most used language overall, ahead of Python and R. It has also been associated with higher wages than Python or R, according to the same survey, as well as ranking high in the list of most loved programming languages (53,7%).

And while StackOverflow's research covers programmers and software engineers of all stripes, the command line is of particular relevance to data scientists because Bash/Shell/Powershell strongly correlates with data science technologies such as Python, IPython/Jupyter, TensorFlow and PyTorch. These conclusions are also pointed out by the research of Python developers (2019, 2020) most recent conducted by the Python Software Foundation.

2. Command line skills help build repeatable data processes

Part of a data scientist's job is to ensure that certain information is available on a regular, often daily basis. Most of the time, this data is acquired, processed and displayed in the same way.

The command line is a suitable tool for this purpose, because series of commands are easily arranged for automatic execution and reproducibly repeatedly.

Consider the following scenario:

Your company decides to invest in data analysis. Several data professionals will join the team. You, as the system and server administrator, are tasked with ensuring that your machines are in the working environment with everything they need to get started.

If you work with a CLI (command language interpreter) you can write some scripts that will install, configure and test everything automatically.

Otherwise, you will have to resort to a GUI and do the same mouse movements and clicks, over and over again, on multiple machines – damn read.

This is just one example of how programming them for endpoints can help make data science processes more scalable and repeatable.

3. Learning Bash makes you more flexible

In roles such as data scientist, programmer, systems administrator; you will often find that you have more flexibility if you can use the terminal rather than having to rely on mouse movements and clicking GUIs.

Since the command line is a program that runs other programs (this is where the name “shell” comes from), the interaction between programs is often easier to adjust from the command line.

Once you've mastered bash commands, even the most basic ones, it's relatively easy to write scripts – small programs that run in the terminal. And shell scripts make building all kinds of data pipelines and workflows much simpler.

More broadly, knowing how to use the shell gives you a second option for interacting with your computer.

Even command lines that seem impossible to remember and difficult to maintain for repeated commands in your everyday life can be easily organized using nicknames (alias) in bash.

You can always use the GUI whenever you want, but the command line can give you more direct power and control when you need it. In addition to saving time for repetitive work, as mentioned in reason 2.

4. Working with text files is easy

Text files are among the most common methods of storing and handling data. Almost any data science project will involve some work with text files. Being able to handle text files quickly and efficiently is therefore a very useful skill for a data scientist.

Software developers also benefit from working on text files with easy transport of data between systems or environments.

The shell has very powerful word processing tools like AWK and sed that help you get familiar with files and make cleaning up data easier.

For example, the code below uses AWK to print the first and third columns of a file named a_csv_file, where the value of the second field is Dataquest, using a comma as the field separator.

awk 'BEGIN {FS=","} {if ($2=="Mazer") {print $1 $3} } a_csv_file'

All this power in a single line of code!

5. Uses less processing resources

When you are working with limited computing resources or simply want to maximize your speed, using the command line will generally be better than using a GUI. This is because using a GUI means dedicating a lot of resources to rendering the graphical output.

This is valid both for working locally and remotely. When connecting remotely to use a server with a graphical interface, the bandwidth consumption will be much higher than traversing just plain text when using the terminals.

In addition latency, i.e. the “time lag between request and response”, will be longer when using a GUI, which can be particularly frustrating if you are trying to control a mouse that is a second or two behind your actual movements.

If you're just typing on the command line, the latency is likely to be lower and it's also easier to control because you know exactly where the cursor is at any given time.

6. “Cloud” management is done by command line

Cloud services are usually connected and operated through a command-line interface.

This is particularly important for jobs managing more advanced systems deployment and data science environments, such as Deep Learning, Data Mining, where your local computing resources are likely insufficient for the tasks that you would like to do.

The 2018 article "Tensorflow on AWS“, from Nucleus Research, states that:

In last year's survey (2017), less than 10 percent of [Deep Learning] projects were running on a local machine. This trend has accelerated, with only 4% of projects running on-premises in 2018.

According to the same article, “96 percent of deep learning – deep learning, today runs in the cloud”.

In short, if you're going to work with advanced cloud services, command-line knowledge is required, from efficiently moving your data to and from the cloud, to managing and running routines in these environments.

7. Unix Shell knowledge is reusable in other shells

There are only a few popular shells (bash, zsh, fish, ksh, tcsh, cmd, Windows PowerShell, etc.) and they are more similar than different, making it easier to switch between them.

For example, the bash commands you are familiar with will work on Unix-based machines such as Macs and Linux computers. But many of the same commands also work on Windows in Command Prompt and/or Windows PowerShell.

This cross-compatibility is particularly useful when you are using online services that require some sort of command-line interface. Even if their system doesn't use bash, it will use a CLI similar enough that you can work with no or minimal tweaks.

8. Performing a large number of actions will be faster in typing than clicking

The search "Hidden Costs of Graphical User Interfaces: Failure to Make the Transition from Menus and Icon Toolbars to Keyboard Shortcuts” – “Hidden costs of graphical user interfaces: Failed to transition menus and toolbars from icons to keyboard shortcuts”, shows that mouse usage stabilizes very quickly, while keyboard usage, despite its initial learning curve, tends to be more efficient.

251 experienced Microsoft Word users were given a questionnaire evaluating their choice of methods for the most frequently occurring commands. Contrary to expectations, most experienced users rarely used efficient keyboard shortcuts, preferring to use icon toolbars.

A second study was done to see if keyboard shortcuts are, in fact, the most efficient method. Six participants performed common commands using menu selection, icon toolbars and keyboard shortcuts. Keyboard shortcuts were, as expected, the most efficient.

In other words, even if you feel like you're working quickly through a GUI, there's a good chance that, at least for some tasks, you're more efficient on the command line.

9. Auditing and debugging is easier

Because it's so easy to track all your activities performed from the command line, auditing and debugging (testing) is much easier.

You can easily examine the history record (log) to track every action performed in the shell, whereas if a wrong click leads to an error when working with a GUI, there is probably no record of it.

Auditing and debugging are essential everyday tasks for server administrators, programmers and data scientists. In this way, the use of graphical interfaces tends to harm both the quality and the security analysis in these professionals' environments.

Furthermore, auditing is closely related to security, and managing security through users and user groups on Linux and Unix using bash is very simple.

10. Linus / Unix Shell is available everywhere

Although it is only integrated into Mac and Linux machines, Windows users can still utilize tools like SWL (Windows Subsystem for Linux), Cygwin and MinGW. (And, as mentioned earlier, many of the bash commands you'll learn work on native Windows options like the command prompt).

This means that the command line skills you learn can be used on virtually every computer you come across (including your personal machine, regardless of the operating system you use).

11. The command line is simpler than you think and will give your day to day great power

There is often a big misconception on the part of beginners that using the command line, or programming for the terminal, requires you to know several hundred commands. In fact, while there are hundreds of commands available to use, chances are you only need a small percentage of these commands to perform most common tasks in your day-to-day life as a systems administrator or data scientist.

Here is an excerpt from the excellent book The Linux Command Line:

When asked to explain the difference between Windows and Linux, I often use a toy analogy.

Windows is like a Game Boy. You go to the store and buy a brand new one in the box. You take it home, turn it on and play with it. Cute graphics, cool sounds. After a while though, you get tired of the game that came with it, so go back to the store and buy another one. This cycle repeats itself indefinitely.

Finally, you go back to the store and say to the person behind the counter, “I want a game that does that!” only to be told that such a game does not exist because there is no “market demand” for it. So you say, "But I just want you to change one thing!" The person behind the counter says you can't change this in game. The games are all sealed in their cartridges. Then you find your toy is limited to the games others have decided you need.

Linux, on the other hand, is like the world's largest buildable suite. You open it up and it's just a huge collection of pieces. There are lots of steel brackets, screws, nuts, gears, pulleys, motors and some suggestions on what to build. So, you start playing around with it. You build one of the suggestions and then another.

After a while, you find that you have your own ideas about what to do. You no longer need to go back to the store as you already have everything you need. The Building Set takes the shape of your imagination. He does what you want. Your choice of toys is obviously a personal thing, so which toy would you find most satisfying?

Ready to learn the “command line”?

Now that I've introduced you to the reasons why to learn bash / shell, I'll let you know that I'm preparing an excellent course from basics to advanced, which will fit your needs, no matter if you are an advanced user, a developer, an administrator systems manager or a data scientist.

To receive information about when the course will be available, values, discounts or early access, follow me on the social channels informed in the table below.

keep up to date

Follow me on twitter and sign the Mazer.dev channel on Youtube to receive updates on new articles, video lessons and free courses in software development and engineering.

More on Linux and Bash

Linux software development environment
If you want to build the best environment for software development in Linux Mint (or Ubuntu or other Debian derivatives), this is the right article for that. Every software developer organizes their work environment for programming using a mix of needs from the technologies they use to program, …
Zsh - intro
Z Shell, or simply zsh, is a powerful interactive shell for consoles and Unix-like operating system terminals like Linux Ubuntu, Mint, Debian among others. In addition to also being a powerful scripting language. Many of the useful features of bash, ksh, and tcsh have been built into zsh; and many …
How to resolve “error: src refspec main does not match any” in Git
The error message: "error: src refspec main does not match any" happens for some routinely common causes, particularly when starting a new project repository. A second line of message with the text: "error: failed to push some refs to 'github.com:nunomazer/my-repository.git'" may also appear in the error stack. Missing…
Free e-books on programming and computing in general
Looking for free e-books on programming, software development, and other areas of computing? This list includes these topics as well as books on software engineering and other subjects. The pandemic period has exploded the number of educational videos and online courses, both in production and in…
How to solve Laradock and Docker error with Python modules
When trying to upload docker containers, to the Laradock distribution, with the default apache2, redis, mariadb and workspace images, I came across the following list of errors. Apparently the errors describe that Python modules are not available, for not finding the *.py files. $ docker-compose up -d apache2 redis …
How to Free Up Hard Disk Space in Linux Ubuntu, Mint, Debian
Running out of space on your Linux system? Here are several ways to clean up your system to free up space on Ubuntu and other Debian-based Linux distributions like Mint. Over time, any operating system's hard drive can become cluttered as programs are added and …

Leave a Reply

Your email address will not be published.

en_USEnglish
%d bloggers like this: