Previously, I have spoken about the power of Linux. We have discussed the benefits for the Linux command line interface (CLI) as well as the Windows CLI and some of the basic commands to know.
Let’s go over just some of the use cases that Linux is great for.
You are able to filter and manipulate data in real-time, just by stringing a few simple commands together. Having your own personal data tool at your fingertips, natively without having to install anything else.
Use Cases
One of the most powerful features of the Linux CLI is the ability to chain commands together using pipes "|". This allows you to connect multiple commands together and use the output of one command as the input for another. (Think of links literally being chained together)
Let’s go over a simple example, the command ls -l | grep ".txt"
will list all files ending with "txt" as the extension in a detailed format. This combines the output of ls -l . and grep “.txt”.
Let’s say you have to rename or move a bunch of files. You could do this via GUI, but it could get cumbersome. With the command line, you could do something like mv file1 file1. mv
for one file or something like mv ~/Downloads/*.txt ~/Documents
for all txt files.
Another advanced feature is the use of redirection operators ">" and ">>". These operators allow you to redirect and append output to a file respectively.
For example, the command ls -l > filelist.txt
will create a file called "filelist.txt" and write the output of the ls -l
command to it.
Or the command echo "1, 2, 3" >> filelist.txt
, which will append the text “1, 2, 3” to the file filelist.txt.
There’s also the ; operator, which is used to separate commands. Think of it as a stage manager, letting you run multiple commands in sequence.
For example, echo "a test"; sleep 5 ; echo "a test". This will run the first echo command, sleep for 5 seconds, then run the final echo command.
Regex
Regular expressions with grep is another powerful feature that can be used to search for patterns in text.
For example, the command
grep -E "^[A-Z]" file.txt
will search for lines in "file.txt" that start with an uppercase letter.
The following command
grep -E "^[aA-zZ]"
will look for any alphabetical letters, this time case-insensitive.
In the next post, we will do a deep dive on regex, and how you can leverage the tool.
Computing
Another use case Linux is greatly used for is computing. This is one that maybe the every day user doesn’t realize, but most apps we use on a day to day basis run on Linux. (That app you’re scrolling through at night 😂, it runs on Linux).
As explained in this blog post by the Linux Foundation, over 90% of public cloud instances are running on Linux. This is because this infrastructure is better suited for massive computation. And these social apps require that computation.
On the job for any Cybersecurity, DevOps or Engineering related roles, you will be working with more Linux servers than anything else.
These are just some of the many powerful abilities of the Linux operating system to discover.
As a reminder, I have a free course available that goes over the fundamentals of Linux.
Check it out here. Feel free to provide feedback, as I’m always looking to improve.
I hope this helps you understand more in your journey in Cybersecurity.