DEV Community

Cover image for Master the Linux Terminal for Modern Data Analytics
Rahimah Sulayman
Rahimah Sulayman

Posted on

Master the Linux Terminal for Modern Data Analytics

INTRODUCTION

In the high-stakes world of Data Analytics, your tools should never be your bottleneck. Most analysts can build a dashboard, but the elite 1% know how to handle data where it actually lives, that is, the Command Line.

Imagine a 10GB CSV file that crashes Excel on sight. While others wait for their GUI to load, the modern analyst uses the Linux Terminal to slice, filter, and audit millions of rows in milliseconds.
As a Data Analyst, I’ve realized that the CLI isn't just an 'extra' skill, it is the engine of efficiency in 2026. While prepping raw data for Power BI, mastering these 'black screen' secrets is how you move from being a passenger to being the pilot of your data infrastructure.

Welcome to the world of Linux! Think of the Linux file system as an upside-down tree. Everything grows from a single point at the very top. What is the Root Directory? The root directory is the starting point of the entire Linux file system.
Every single file, folder, and drive on your computer is contained within it.
It is represented by a single forward slash: /.
The "Parent": It has no parent directory, it is the absolute top level.

To get started, you have three ways to use these exact Linux commands on a Windows machine:

1. WSL
WSL (Windows Subsystem for Linux) is a literal Linux system living inside your Windows computer. It’s what almost all developers use today.

How to get it: Open your Windows Terminal and type wsl --install.
This runs the Result on your actual hard drive.

2.Git Bash
If you install Git for Windows, it comes with Git Bash. It’s a small emulator that lets you use Linux commands to navigate your Windows folders.

In Git Bash, your C: drive is usually mapped to /c/.

3.PowerShell
PowerShell actually has "aliases" for some Linux commands to make life easier for people moving between systems. It serves as a translator.
NOTE: Windows and Linux speak different "languages." though there are some similarities.
Windows uses PowerShell or Command Prompt (CMD), where the root is usually C:. Linux uses the Bash shell, where the root is /.

I'll be using Git Bash is actually one of the most popular ways for developers to use Linux commands on a Windows computer,and I already have it in VS Code.

When you open Git Bash in VS Code, you are essentially running a "mini Linux environment" that can see your Windows files.

HOW TO USE IT

Open the Terminal: In VS Code, press Ctrl +` (the backtick key). Or select View, then Terminal.

view

Select Git Bash: In the top-right corner of the terminal pane, click the dropdown arrow (usually says "powershell" or "cmd") and select Git Bash.

gitbash

If you want to explore these right now in your terminal, here is how you can use those commands:

  • Jump to Root: Type cd / to move to the very top.
  • See Where You Are: Type pwd(Print Working Directory). It should just show /.
  • Look Around: Type ls to see all the folders (like bin, etc, and home) living inside the root. These aren't your Windows C: drive folders, they are the virtual Linux-style folders Git Bash creates to make your commands work.

root directory

This is the most important part for a beginner. Git Bash "mounts" your Windows drives inside the root.

To go to your C: Drive, type: cd /c/
To go to your Desktop, type: cd /c/Users/YourUsername/Desktop

Change directory to the desktop

NOTE: My computer is using the username Admin inside the folders, even though your machine name is RAHIMAH-ISAH. Linux is very literal about where things are stored.
So cd /c/Users/Admin/Desktop is the full "map" to my Desktop

where:

  1. cd: Change Directory.
  2. /c/: This is your C: Drive.
  3. Desktop: This is your destination.

desktop

To move from my current location into the My_Analytics folder on the Desktop, I'll use the cd (change directory) command:
cd My_Analytics

My_analytics

Create a "test" folder
To create a new folder (directory), use the mkdir (make directory) command:
mkdir test

But first, change directory to the previous: cd ..

testfolder

If you want to see if your new folder was actually created, type ls. It will list everything in your current location, and you should see test appearing in the list.

LS

Out of curiosity, being a beginner it's allowed to check the Desktop.

Desktop

Let's learn how to use these, try this "Real World" sequence in the VS Code Git Bash:

Go to your User folder: cd ~ (The tilde ~ is a Linux shortcut for your home).

Create a project folder: mkdir my-linux-practice2

Enter the folder: cd my-linux-practice2

mkdir

Create a blank file: touch notes.txt

Verify it's there: ls

blank file

I made use of "-" instead of "_".
Let's make the correction together.

In Linux, we use the mv command (short for move) to rename files and folders.

Since am currently on the Desktop, I can "move" the folder from the old name to the new name.

The Correction Command
Type this and press Enter:

mv linux-practice linux_practice

How it works
The mv command follows a simple logic:
mv [old_name] [new_name]

linux-practice: The folder as it exists now.
linux_practice: What you want it to be named.
I did not remember the exact folder name, so I used the ls command.

ls

And then verified the name change by running ls command.

Create a message
We are going to use the echo command. It literally "echoes" whatever you type back to you, but we are going to use a special symbol > to tell it to echo into a file instead.

Remember to enter the Directory if you aren't already there:
cd /c/Users/Admin/Desktop/notes.txt

echo "Hello from the Linux terminal!" > notes.txt

Read your file
Now, let's see if the file actually contains that message.

Type this and press Enter:

cat notes.txt
cat (short for concatenate) is the standard way to quickly read the contents of a file in the terminal.

echo

What just happened?

  • echo "text": Prepared the message.
  • >: This is called a Redirect. It took the message that would normally print on the screen and "poured" it into the file.
  • cat: Showed you the result.

Since we've already used > to create the file, let's learn how to add a second line to it without deleting the first one.

Step 1:Go back into your folder (if you left it)
cd /c/Users/Admin/Desktop/notes

Step 2:Add a new line (use two symbols >>)

  • > = Overwrites the file (deletes old stuff).
  • >> = Appends (adds to the bottom).

echo "This is my second line!" >> notes.txt

Step 3:Read it (check your spelling!)
cat notes.txt

secondline

Use echo with >> to add another line:

echo "This is my third line!" >> notes.txt

Verify the result:
If you run cat notes.txt now, you should see:

Hello from me!
This is my second line.
This is my third line!

NOTE:
In Linux, case sensitivity is everything. If you create a file named Notes.txt (with a capital N) and then try to read notes.txt (with a lowercase n), the terminal thinks they are two completely different files.
When you type a command like cat and press Enter, the terminal will seem to "freeze." This is because cat without a filename waits for you to type something into it.

Whenever a command gets stuck like that, press Ctrl + C on your keyboard to kill the process and get your prompt back.

Hidden files
In Linux, you can make a file "hidden" just by starting its name with a period (.). These are usually used for important system settings that you don't want to see cluttering your folders.

Step 1: Create a hidden file (in my folder my_linux_practice2)
Type this and press Enter:
touch .secret_note.txt

Step 2:Try to find it with a normal ls
Type this:
ls
(Notice that it doesn't show up, even though it's there.)

secretfile

Step 3:Reveal the hidden files
To see everything (including hidden files), you need to add a "flag" to your command.
Type this:
ls -a

-a: stands for "all".

toseeall
.: This represents the current directory you are in.

..: This represents the parent directory (one level up).

.my_secret_file.txt: The brand new hidden file!

Being a Data Analyst and Cloud Engineer, I see these "dot files" (like .git or .env) all the time in your professional work. Knowing how to find them using ls -a is a critical skill.

To delete files in Linux, we use the rm command (short for remove).

Be careful: unlike Windows, there is no "Recycle Bin" in the Linux terminal. Once you delete a file with this command, it is gone for good!

The Deletion Command
Type this and press Enter:

rm .secret_note.txt

Verify it is gone
Since this was a hidden file, a normal ls wouldn't have shown it anyway. To be 100% sure it’s deleted, you need to use the "all" flag again.

Type this:
ls -a

delete

What you should see: notes.txt, plus the system markers . and ...

What should be missing?: .secret_note.txt.

While working, for example, with Azure and Power BI, you'll often have folders full of data files. If you ever need to delete an entire folder and everything inside it, you have to add a "recursive" flag:

rm -r folder_name

Warning: Never type rm -rf /. This tells Linux to "Force Delete Everything starting from the Root," which would erase your entire operating system!

Copying is another fundamental skill, especially when you want to create backups of your scripts or data reports before you make changes.

In Linux, we use the cp (copy) command.

Step 1: Create a simple copy
Let's take the existing notes.txt and create a backup called backup.txt.

Type this and press Enter:

cp notes.txt backup.txt
Step 2: Verify the copy
Now, let's see if you have two separate files now.

Type this:
ls

You should see both notes.txt and backup.txt listed.

copy

Copy into a new folder
Now let's get a bit more organized. Let's create a "logs" folder and copy the file into it.

Step 1:
Create the folder:
mkdir logs

Step 2:
Copy the file into the folder:
cp notes.txt logs/

Step 3:
Check inside the logs folder:
ls logs
This tells ls to look specifically inside the logs directory without you having to cd into it.

copytofolder
Now the logs folder is no longer empty, it contains the notes.txt file.

The "Dot" Trick
If you are already inside a folder and want to copy a file from somewhere else into your current spot, you use a period . (which means "here").

Example (Try this on your own):
cp /c/Users/Admin/Desktop/important.txt .
(This translates to: "Copy important.txt from the Desktop to here.")

Copying a folder
Since we are copying a folder (the logs folder) instead of a single file, we need to use a special flag. In Linux, if you try to copy a folder without this flag, the terminal will give you an error saying "omitting directory."

To copy a directory and everything inside it, we use -r (which stands for recursive).

The Copy Directory Commands
Step 1: Copy the logs folder to a new name
Type this and press Enter:
cp -r logs logs_backup

Step 2:Verify both folders exist
Type this:
ls -F
(The -F flag is a neat trick,it adds a / to the end of folder names so you can easily tell them apart from files!)

copyfolder

Step 3:Copy a file from one folder to another
Let's practice moving things between folders without leaving your current spot. Let's copy the file inside logs into logs_backup but give it a new name.

Type this:
cp logs/notes.txt logs_backup/archive_copy.txt

Step 4:Check the contents of the backup folder
ls logs_backup
You should now see both notes.txt and archive_copy.txt inside that folder.

backup

The "Tab" Trick
To avoid typos (like lowercase vs. uppercase), try this:
Type cd lin and then press the Tab key on your keyboard. Git Bash will automatically finish the word linux_practice for you! It’s like magic and prevents almost all errors. You can try it with the first few letters of your file and folder names.

Creating Multiple folders
Creating multiple folders at once is a huge time-saver for any Data Analyst. Instead of typing mkdir five separate times, we can do it in one single line.

In Linux, there are two ways to do this: the Simple List and the Brace Expansion (the "Pro" way).

Method 1: The Simple List
You can simply type mkdir followed by all the names you want, separated by spaces.
mkdir Jan Feb Mar Apr May Jun

multiplefolders
Result: 6 new folders appear instantly.

Method 2: Brace Expansion {} (The Power Move)
This is how engineers create hundreds of folders in a second. It uses curly brackets to tell Linux: "Take this prefix and attach all these options to it."

Try creating six months of data folders like this:

mkdir month_{1..6}
Result: You will get month_1, month_2, up to month_6.

method2

Method 3: Nested Folders (The -p Flag)
Sometimes you want to create a folder inside a folder that doesn't exist yet (like a file path). If you just try mkdir Project/Data, it will fail. You need the -p (parents) flag.

Try this to build a full project structure in one go this way:

mkdir -p Analytics_Project/{customer,date,region,price}

third

What happened?

  1. It created the main folder Analytics_Project.
  2. Inside it, it created 4 sub-folders: customer, date, region, and price. To see your beautiful new structure without clicking around your Desktop, use the "Recursive List" command: ls -R Cloud_Project

list

checking

After creating multiple folders, knowing how to clean them up is just as important. In Linux, there are two main ways to delete a directory, depending on whether it has files inside it or not.

Method 1: The "Safety" Way (rmdir)
If a folder is completely empty, you use rmdir (remove directory). This is safe because Linux will refuse to run the command if there is even one tiny file inside, preventing accidental data loss.

Try it on one of your empty month folders:
rmdir Jan

Method 2: The "Force" Way (rm -r)
If the folder has files, scripts, or other folders inside it, rmdir won't work. You must use the rm command with the -r (recursive) flag. This tells Linux to go "inside" the folder and delete everything first, then delete the folder itself.

Try it on your Analytics_Project folder:
rm -r Analytics_Project
A Critical Warning for Cloud Engineers and Data Analysts
In Linux, there is no "Recycle Bin." Once you run rm -r, that data is gone forever.

The "Danger" Command:
You will often see rm -rf.

-r: Recursive (deletes folders).
-f: Force (doesn't ask "Are you sure?").

Always double-check your current location with pwd before running a recursive delete.

The "Real-life" Challenge
We are going to simulate a real-world task: Organizing a project*.
Step 1: Create the Workspace
Create a main project folder and two sub-folders in one line:
**mkdir -p My_Analytics/{raw_data,final_reports}
*

Step 2:Create a "Data" file
Let’s create a dummy data file inside the raw_data folder:

touch My_Analytics/raw_data/sales_2026.csv

Step 3:Copy the file (The "Backup" Move)
Before you edit data, you should always have a copy. Use cp (copy)

cp My_Analytics/raw_data/sales_2026.csv My_Analytics/raw_data/sales_backup.csv

Step 4:Move the file (The "Organization" Move)
Now, let's pretend you finished your analysis. Move the original file to the final_reports folder using mv (move):

mv My_Analytics/raw_data/sales_2026.csv My_Analytics/final_reports/

Check Your Work
Use the Tree view (or recursive list) to see your organized project:

ls -R My_Analytics

reallife

Since you've already learned how to create, move, and delete folders, the next "superpower" for a Data Analyst is being able to see what is inside a file without needing to open a heavy application like Excel or Notepad.

Imagine you just downloaded a massive dataset from an Azure storage bucket. You need to know if it's the right data before you start your analysis.

Practice 1: Creating a "Data" File
First, let's create a file with some actual content inside it so we have something to look at.

Type this command:

echo -e "ID,Name,Sales\n1,Rahimah,500\n2,Ibrahim,750\n3,Dickson,300" > sales_data.csv
What this does:

  • echo prints text.
  • -e allows for "new lines" (\n).
  • > saves that text into a new file called sales_data.csv.

Practice 2:The "Peeking" Commands
Now, let's look at the data using three different tools.

  1. The cat Command (Concatenate) This dumps the entire file onto your screen.

cat sales_data.csv
Use this when: The file is small (like a configuration file).

2.The head Command
This only shows the first few lines.

head -n 2 sales_data.csv
Use this when you have a 1-million-row CSV and just want to see the column headers.

3.The tail Command
This shows the very end of the file.

tail -n 1 sales_data.csv
Use this when: You want to see the most recent entry in a log file.

Practice 3:The "Search" Power (grep)
This is the command Data Analysts use most. It searches for a specific word inside a file. Suppose you only want to see the sales for "Ibrahim".

Type this:
grep "Ibrahim" sales_data.csv

Result: It will ignore everything else and only show you the row for Ibrahim.

head

It actually created an .csv file, amazing!

excel

excel

Why this matters for you
Analysts love finding needles in haystacks.

Imagine searching a 2GB file for a specific Transaction ID. In Excel, your computer freezes. In the CLI, grep 'TXN_9984' data.csv finds it in milliseconds.
When you are working as a Data Analyst, you might have thousands of logs. Instead of scrolling through them, you use grep Error to find exactly where something went wrong in your Azure pipeline.

Final Command for today: history
Want to see a list of everything you've done in this session?

Type this in your Git Bash:
history

history

CONCLUSION

Mastering the Linux Terminal is more than just learning a list of commands; it is about adopting a mindset of efficiency and automation. In an era where data volumes are exploding and cloud infrastructure is the standard, the ability to navigate a server, audit a massive CSV, or automate a directory structure is what separates a traditional analyst from a modern data professional.

As you move from the GUI to the CLI, you aren't just changing how you interact with your computer—you are expanding your capacity to handle "Big Data" that others simply cannot touch. Whether you are building pipelines in Azure, managing repositories on GitHub, or cleaning raw data for Power BI, the terminal is the bridge that connects your analytical skills to the global tech ecosystem.

The Challenge
Don't let these commands sit idle. Open your Git Bash today, navigate to your projects using only your keyboard.

Top comments (0)