Linux Basics for DevOps Beginners

Navigate the Linux terminal, manage files, and run your first Bash script.

Introduction

30 Second Summary

Every time you use your computer, you click through menus and drag files around with a mouse. Underneath all of that is a text-based window called the terminal, where you can do the same things faster by typing short commands.

In this project, you will open the Linux terminal for the very first time and learn to control your computer with typed commands. By the end, you will have built a personal DevOps workspace entirely from the command line.

What You'll Build

You will type a single command and watch your computer respond instantly, creating folders, moving files, and printing messages back to you.

By the end of this project, you'll have:

  • The ability to navigate your entire file system from the terminal, jumping between folders and listing their contents without touching a mouse.
  • A custom project folder built from scratch with subfolders and text files you created, organized, and tidied up using nothing but typed commands.
  • A journal entry written in a terminal text editor that you can search with one command to find exactly the word you need.
  • Secret Mission: Build a complete DevOps workspace from scratch and write your very first Bash script.

Do I need any prior experience?

No prior terminal or command-line experience is required. You just need a computer running Linux Mint XFCE edition.

Before We Start

Before you touch the terminal, let's lock in what you're about to build and why it matters.

By the end of this project, you'll have a personal DevOps workspace on your Linux Mint machine, built entirely from terminal commands.

Say Hello to the Terminal

The terminal is your most powerful tool as a DevOps engineer. Instead of clicking through menus and windows, you type a command and see instant results.

In this step, you will open the terminal for the first time and type a handful of simple commands. By the end, the terminal will know your name and today's date.

In this step, get ready to:
  • Open Xfce Terminal for the first time.
  • Run your first Linux commands and see their output.
  • Print your name and today's date to the screen.
Open the terminal

There are two ways to open the terminal on Linux Mint XFCE. The quickest way is a keyboard shortcut.

  • Press Ctrl+Alt+T on your keyboard.

If that shortcut does not work, you can open it through the menu instead:

  • Click the Menu button in the bottom-left corner of your screen.
  • Click System.
  • Click Xfce Terminal (also labeled Terminal Emulator).

A dark window appears with a blinking cursor. This is your terminal.

What is the prompt?

The text before the cursor (something like yourname@yourmachine:~$) is called the prompt. It is part of Bash, the command-line program running inside your terminal.

The $ at the end means the terminal is ready for your command. You type after it and press Enter to run.

Type your first commands

Every command below is typed at the prompt and run by pressing Enter. Watch what happens after each one.

  • Find out your Linux username by running this command:
whoami

The terminal prints your username, like alex. This confirms who you are logged in as.

  • Check which folder you are currently in by running:
pwd

You should see a path like /home/alex. This is your home folder, the starting point for everything you do.

  • Print today's date and time by running:
date

What did these commands tell you?

  • whoami printed your username.
  • pwd printed your current folder path (your home folder).
  • date printed the current date and time.

These three commands are your "where am I and what time is it" toolkit. DevOps engineers use them constantly to orient themselves on a server.

  • Make the terminal repeat your name back to you by running this command:
echo "My name is [[YOURNAME="enter your name"]]"

The terminal prints your name right back at you. The echo command repeats whatever text you put inside the quotes.

  • Clear the clutter from your screen by running:
clear

Your screen is now clean. Nothing was deleted. The clear command just tidies up the view.

Seeing 'command not found'?

Check for typos. Commands are case-sensitive. whoami works, but WhoAmI does not.

Make sure you pressed Enter after typing the command. If the terminal is still showing a blinking cursor on the same line, press Enter now.

Why is my terminal command not working?

Print your name and today's date

Time for your first challenge. Combine the commands you just learned to print your name and today's date to the screen in one sequence.

  • Print your name by running this command, using your own name:
echo "My name is [[YOURNAME="enter your name"]]"
  • Print a label for the date by running:
echo "Today's date is:"
  • Print the actual date by running:
date

Your terminal now shows your name and today's date. You just told the computer what to do, and it did it.

One more command. Before you run it, what do you think the terminal will print?

  • Test your prediction by running:
echo "Hello, DevOps!"

The terminal prints Hello, DevOps! on the next line. You gave the terminal a message and it delivered.

Nothing printed, or seeing a > symbol?

If you see a > symbol instead of output, you are missing a closing double quote. Press Ctrl+C to cancel and type the command again, making sure both quotes are present.

Double-check that you typed echo in all lowercase. Uppercase letters will cause a "command not found" error.

My echo command is not printing anything. What did I do wrong?

Your terminal is alive and responding to your commands. Next up, you will learn how to navigate around your computer's folders without ever touching the mouse.

Move Around Your Computer

You just typed your first terminal commands and saw instant results on screen. The terminal already knows your name, the current date, and how to echo text back to you.

Right now you can only see what is in your home folder. To work with files anywhere on your computer, you need to learn how to move between folders.

In this step, get ready to:
  • List files and folders in your current directory using ls.
  • Navigate between folders using cd.
  • Explore your file system and return home with confidence.
Look around with ls

Before moving anywhere, let's see what is already in your home folder. The ls command lists everything in your current directory.

  • See what files and folders are in your home directory by running:
ls

You should see familiar folder names like Desktop, Documents, and Downloads.

Sometimes you need more than just names. The long format shows extra details like permissions, owner, size, and date.

  • See the same list with extra details by running:
ls -l

What does ls -l show?

The -l flag stands for "long format." Each line now shows permissions, the owner, the file size, and the date it was last modified. This is useful when you need more info than just the name.

Linux can hide files by starting their name with a dot. These hidden files are usually configuration files that you do not need to touch day to day.

  • See all files, including hidden ones, by running:
ls -a

What are hidden files?

Any file or folder whose name starts with a period (like .bashrc) is hidden from the regular ls output. The -a flag reveals them all.

Navigate between folders with cd

Now you can see what is in a folder, but to get to a different folder you need the cd command. It stands for "change directory."

  • Move into your Documents folder by running:
cd Documents
  • Confirm you moved by running:
pwd

You should see a path like /home/yourname/Documents. That confirms you are now inside the Documents folder.

To go back up one level, use .. which means "the folder above me."

  • Move back up one level by running:
cd ..
  • Confirm you are back home by running:
pwd

You should see your home folder path again, like /home/yourname.

The ~ symbol always means "my home folder," no matter where you are on the system. It is the quickest way to jump straight home.

  • Jump straight to your home folder by running:
cd ~

Your file system has a very top level called the root directory, represented by a single /. Every folder on your computer lives somewhere under this root.

  • Visit the root of your entire file system by running:
cd /
  • Take a peek at the system folders by running:
ls

You should see system folders like bin, etc, home, and usr. Your home folder lives inside the home folder.

  • Return to your home folder by running:
cd ~

Save typing with Tab completion

Try typing cd Doc and then pressing the Tab key. The terminal auto-completes it to cd Documents. This saves typing and prevents typos. Use it constantly.

Mini-challenge: Explore and return

Time to put your navigation skills together. Complete the following sequence on your own.

  • Navigate to your Documents folder by running:
cd Documents
  • List what is inside by running:
ls
  • Navigate back to your home folder by running:
cd ~
  • Confirm you are home by running:
pwd

You should see your home path (like /home/yourname) confirming you made it back.

Now for the final check. Before you run the next command, predict: what folder path do you think you will see printed?

  • Verify your navigation skills in one shot by running:
cd ~/Documents && pwd

You should see /home/yourname/Documents printed. That confirms you jumped straight to Documents from wherever you were.

What does && do?

The && symbol chains two commands together. The second command (pwd) only runs after the first (cd ~/Documents) succeeds. It is a quick way to do two things in one line.

  • Return to your home folder by running:
cd ~

Seeing 'No such file or directory'?

You are probably in the wrong folder. Type pwd to check where you are, then run cd ~ to go home and try again.

Also remember that folder names are case-sensitive in Linux. Documents is not the same as documents.

Help me troubleshoot a 'No such file or directory' error when using cd on Linux Mint.

You can now move around your computer without ever touching a mouse. Next up, you will start creating your own folders and files from scratch.

Create Files and Folders

You can navigate to any folder on your computer now. But every folder you have visited so far came pre-installed with Linux Mint.

To start organizing your own work, you need to create files and folders from scratch. This is exactly what you will do on every DevOps project.

In this step, get ready to:
  • Create a project folder with subfolders using mkdir.
  • Create empty text files using touch.
  • Verify your folder structure from the command line.
Create folders with mkdir

The mkdir command creates new folders (also called directories). You tell it the name you want, and the folder appears instantly.

  • Make sure you are in your home folder, then create a new folder called devops-journey by running these commands:
cd ~
mkdir devops-journey
  • Confirm the folder was created by running:
ls

You should see devops-journey listed alongside your existing folders like Desktop, Documents, and Downloads.

  • Move into your new folder and create three subfolders inside it by running these commands:
cd devops-journey
mkdir notes scripts projects

What does this command do?

You can pass multiple names to mkdir separated by spaces. Instead of running three separate commands, mkdir notes scripts projects creates all three folders in one go.

  • Confirm all three subfolders exist by running:
ls

You should see notes, projects, and scripts listed.

Seeing 'File exists'?

This means you already created that folder. Run ls to verify it is there, and move on.

If you accidentally created a folder with the wrong name, no worries. You will learn how to rename and delete things in the next step.

Help me fix a mkdir error in my terminal.

Create empty files with touch

The touch command creates a new empty file. If the file already exists, it updates the file's timestamp without changing its contents.

  • Move into the notes folder by running:
cd notes
  • Create three empty text files by running:
touch day1.txt day2.txt day3.txt

What does this command do?

Just like mkdir, you can pass multiple names to touch separated by spaces. This creates all three files in one command.

  • Confirm the files were created by running:
ls

You should see day1.txt, day2.txt, and day3.txt listed.

  • Check the file details by running:
ls -l

Each file shows a size of 0 because they are empty. The long format also shows who owns the file and when it was created.

Don't see your files?

Make sure you ran cd notes before running touch. Type pwd to check where you are. You should see a path ending in /devops-journey/notes.

If you are in the wrong folder, run cd ~/devops-journey/notes to get to the right place, then try the touch command again.

Help me figure out why my files were not created.

Verify your folder structure

Time to step back and inspect everything you have built so far.

  • Navigate back to your devops-journey folder by running:
cd ~/devops-journey
  • List the contents of this folder by running:
ls

You should see your three subfolders: notes, projects, and scripts.

Before you run the next command, predict what you will see inside the notes folder.

  • Check the contents of the notes folder by running:
ls ~/devops-journey/notes

You should see day1.txt, day2.txt, and day3.txt listed. Those are the three empty files you created with touch.

Your project folder structure is ready. Next up, you will learn how to copy, move, rename, and delete files to keep things organized.

Copy, Move, Rename, and Delete

You have a neat folder structure inside devops-journey, complete with subfolders and files. That is a great start.

Real projects get messy. Files end up in the wrong place, need different names, or need to be cleaned up. This step teaches you the four commands that keep things tidy.

In this step, get ready to:
  • Copy and move files between folders.
  • Delete files and folders safely.
  • Tidy up a messy folder as a mini-challenge.
Copy and move files

Two commands handle most file management: cp copies a file, and mv moves or renames one. You will practice both right now.

  • Switch back to your devops-journey folder by running:
cd ~/devops-journey
  • Copy day1.txt to a new file called day1-backup.txt by running:
cp notes/day1.txt notes/day1-backup.txt
  • Confirm the copy worked by running:
ls notes

You should see day1-backup.txt alongside your original day1.txt, day2.txt, and day3.txt.

What does cp do?

cp creates a duplicate of a file. The original file stays exactly where it is, completely untouched. You always write the source file first, then the destination.

  • Move the backup file into the projects folder by running:
mv notes/day1-backup.txt projects/
  • Confirm the file arrived by running:
ls projects

You should see day1-backup.txt listed inside projects. It is no longer in the notes folder.

  • Rename the file to something more descriptive by running:
mv projects/day1-backup.txt projects/my-first-backup.txt
  • Confirm the rename by running:
ls projects

You should see my-first-backup.txt instead of day1-backup.txt.

How does mv work?

mv serves double duty. When the destination is a different folder, it moves the file there. When the destination is a new name in the same folder, it renames the file.

Unlike cp, mv does not leave a copy behind. The original is gone after the move or rename.

Seeing 'No such file or directory'?

  • Check that you are in the devops-journey folder. Run pwd to confirm your location.
  • Make sure the file name matches exactly, including case. Day1.txt is not the same as day1.txt.
  • help me fix a 'No such file or directory' error with cp or mv
Delete files and folders

rm deletes permanently

rm deletes files permanently. There is no Trash or Recycle Bin when you use rm. Once a file is gone, it is gone.

Always double-check the file name before pressing Enter. You will practice on test files here, so nothing important is at risk.

  • Delete my-first-backup.txt from the projects folder by running:
rm projects/my-first-backup.txt
  • Confirm the file is gone by running:
ls projects

The projects folder is now empty. No output from ls means nothing is inside.

Now try removing a folder. rmdir removes empty folders, which acts as a built-in safety feature.

  • Create a temporary folder for practice by running:
mkdir projects/temp-folder
  • Remove the empty folder by running:
rmdir projects/temp-folder
  • Confirm it is gone by running:
ls projects

The projects folder is empty again.

Why use rmdir instead of rm?

rmdir only works on empty folders. If there are files inside, it refuses to delete anything. This protects you from accidentally wiping out a folder full of important files.

Seeing 'Directory not empty'?

  • rmdir only removes empty folders. You need to delete the files inside with rm first, then remove the folder.
  • help me delete a folder that is not empty
Tidy up a messy folder

Time to practice everything together. You will create a mess on purpose, then clean it up using mv and rm.

  • Create three messy files inside your notes folder by running:
touch notes/oops.txt notes/deleteme.txt notes/wrong-place.txt
  • See the mess you just created by running:
ls notes

You should see six files: your three day files mixed in with oops.txt, deleteme.txt, and wrong-place.txt.

Now tidy things up. Each file needs different handling.

  • Move wrong-place.txt to the projects folder by running:
mv notes/wrong-place.txt projects/
  • Delete oops.txt by running:
rm notes/oops.txt
  • Delete deleteme.txt by running:
rm notes/deleteme.txt
  • Finish the cleanup by removing wrong-place.txt from projects too:
rm projects/wrong-place.txt

Before you check your work, what do you expect to see in your notes folder?

  • Check your notes folder by running:
ls ~/devops-journey/notes

You should see only day1.txt, day2.txt, and day3.txt. The messy files are gone.

Still seeing extra files?

  • If oops.txt or deleteme.txt still appear, re-run the matching rm command above. Check for typos in the file name.
  • If wrong-place.txt still appears in notes, the mv command did not run successfully. Run it again with the exact path shown above.
  • help me clean up extra files in my notes folder

What if I accidentally delete the wrong file?

rm is permanent. This is why you practiced on test files first. In real DevOps work, you protect important files with backups and version control tools like Git.

Your files are organized, but they are still empty. In the next step, you will write real content into your files, read it back, and search through everything you have built.

Read, Write, and Find Things

Your devops-journey folder is looking clean. You can move files where they belong, rename them, and toss what you don't need. Now there is just one problem.

Every file you created is still empty. Real DevOps work means writing configuration files, reading logs, and searching through them to find what matters. In this step, you'll bring your files to life.

In this step, get ready to:
  • Write a journal entry using the nano text editor and read it back with cat, head, and tail.
  • Search inside files with grep and locate files by name with find.
  • View your full command history and learn how to get help for any command.
Write and read files

Your day1.txt file is empty right now. The nano text editor lets you write content directly inside the terminal without needing a separate application.

  • Move into the notes folder by running this command:
cd notes

When you open a file with nano, you'll see a text editing area and a shortcut bar at the bottom of the screen. The shortcuts use the ^ symbol, which means the Ctrl key.

  • Open day1.txt in nano by running:
nano day1.txt

What will I see in nano?

You should see a mostly blank screen with the filename at the top and shortcut hints at the bottom. This is the nano editor. Your cursor is in the editing area, ready for you to start typing.

  • Type this journal entry into the editor:
Day 1 of my DevOps journey
Today I learned how to use the terminal.
I can navigate folders and create files.
This is exciting!
I learned the commands: whoami, pwd, ls, cd, mkdir, touch.
  • Save the file by pressing Ctrl+O.
  • Press Enter to confirm the filename.
  • Exit nano by pressing Ctrl+X.

You should be back at the regular terminal prompt. Time to read back what you wrote.

  • Print the contents of your journal entry by running:
cat day1.txt

You should see your full journal entry printed to the screen, exactly as you typed it.

What does cat do?

The cat command (short for "concatenate") prints the entire contents of a file to the terminal. It is the quickest way to peek inside a file without opening an editor.

Sometimes you only need to see part of a file. Two commands help with that.

  • View only the first 2 lines of your journal by running:
head -2 day1.txt

You should see just the first two lines of your entry.

  • View only the last 2 lines by running:
tail -2 day1.txt

You should see the last two lines of your journal.

When would I use head and tail?

The head command shows lines from the top of a file. The tail command shows lines from the bottom.

DevOps engineers use these constantly. head is great for checking the start of a configuration file. tail is perfect for viewing the latest entries in a log file.

Nano looks weird or you cannot type?

Make sure you are not accidentally holding Ctrl or Alt while typing. Just type normally, like in any text editor.

If you get stuck, press Ctrl+X to exit. It will ask if you want to save your changes.

Help me troubleshoot nano

Search inside files and find files

Now that you have a file with real content, you need a way to search through it without reading every line. You also need a way to find files by name when you forget where they live.

First, create a second file to give yourself more content to search through.

  • Create a new file called shopping.txt by opening it in nano:
nano shopping.txt
  • Type this short shopping list:
apples
bread
milk
chocolate
bananas
coffee
  • Save with Ctrl+O, press Enter to confirm.
  • Exit with Ctrl+X.
  • Confirm the file was created by running:
cat shopping.txt

You should see your six-item shopping list printed to the screen.

Now use grep to search for specific items inside the file.

  • Search for "chocolate" in your shopping list by running:
grep "chocolate" shopping.txt

You should see the line containing "chocolate" printed and highlighted.

  • Try another search by running:
grep "milk" shopping.txt

You should see the line with "milk" highlighted.

What does grep do?

The grep command searches for a specific word or pattern inside a file. It prints every line that contains a match.

DevOps engineers use grep constantly to hunt through log files, configuration files, and command output for specific errors or settings.

Searching inside files is one thing. Finding a file when you have forgotten where you put it is another.

  • Locate day1.txt anywhere in your project folder by running:
find ~/devops-journey -name "day1.txt"

You should see the full path printed, something like /home/yourname/devops-journey/notes/day1.txt.

  • Find all .txt files in your project by running:
find ~/devops-journey -name "*.txt"

You should see every text file you have created listed with its full path. The * is a wildcard that means "match anything."

What is the difference between grep and find?

The grep command searches for a word inside a file. The find command searches for a file by name across folders.

Think of it this way: find tells you where a file lives. grep tells you what is inside it.

Two more tools will help you as you keep learning.

  • View every command you have typed in this session by running:
history

You should see a numbered list of every command from your entire terminal session. This is useful when you need to recall something you typed earlier.

  • See all the options available for the ls command by running:
ls --help

You should see a summary of every flag and option that ls supports. Almost every Linux command supports --help, so you can always look up what a command can do.

Grep says 'No such file or directory'?

You are probably in the wrong folder. Type pwd to check where you are. You should be in ~/devops-journey/notes.

If you are somewhere else, run cd ~/devops-journey/notes to get to the right place, then try the command again.

Help me fix my grep or find command

Search your shopping list

Time to put your new search and reading skills to the test. Complete these three challenges on your own.

  • Use grep to find "coffee" in your shopping list by running:
grep "coffee" shopping.txt

You should see the word "coffee" highlighted on its own line.

  • Show only the first two lines of your journal by running:
head -2 day1.txt

You should see "Day 1 of my DevOps journey" and "Today I learned how to use the terminal."

  • Locate the shopping.txt file from anywhere in your project folder by running:
find ~/devops-journey -name "shopping.txt"

You should see the full path to your shopping list printed.

Before you run the next command, what do you think grep "learned" day1.txt will find in your journal? How many lines contain that word?

  • Verify that your journal is searchable by running:
grep "learned" ~/devops-journey/notes/day1.txt

You should see two lines from your journal entry, each containing the word "learned", highlighted in the output.

Secret mission

Build Your DevOps Workspace

You have learned every individual terminal skill. Now combine them all into one mini-project that proves you can work in the terminal from start to finish. Create a complete workspace, back up your files, generate a listing, and write your very first Bash script.

Clean Up Your Resources

Clean Up Your Resources

This project runs entirely on your local Linux Mint machine, so there are no ongoing costs or cloud services to worry about. Decide whether to keep your files for future practice, or delete them to start fresh.

Resources you used:

  • The ~/devops-journey folder and all its contents (notes, scripts, projects, and the DevOps Workspace you built in the Secret Mission).

Keep everything running

No action needed. Choose this if you want to keep practicing your terminal skills or revisit the files you created.

  • Your ~/devops-journey folder stays on your computer with all your notes, scripts, and the DevOps Workspace.
  • These are plain text files and folders that take up almost no disk space.
  • You can return to them any time by opening your terminal and typing cd ~/devops-journey.

Pause - I'll come back to this later

Since everything lives as local files on your machine, there is nothing to shut down or pause. Your files sit quietly on disk until you need them again.

  • Close your terminal window when you are done.
  • Your ~/devops-journey folder and all its contents remain exactly where you left them.
  • When you are ready to come back, open a new terminal and type cd ~/devops-journey to pick up where you left off.

Delete - I don't want to use this again

Remove all project files and start fresh. This permanently deletes everything you built during this project.

  • Delete the entire ~/devops-journey folder and all its contents by running this command in your terminal:
rm -rf ~/devops-journey
  • Confirm the folder is gone by running:
ls ~/devops-journey

You should see a message saying No such file or directory. That confirms the folder has been deleted.

This is permanent

Remember, rm -rf deletes files permanently with no Trash or Recycle Bin. Make sure you are ready to let go of your practice files before running this command.

Nice Work!

Nice Work!

You just built a personal DevOps workspace entirely from the Linux terminal. No file managers, no clicking around. Just you, a blinking cursor, and a whole lot of new skills.

Here's what you learned:

  • Opened the terminal for the first time, typed your first commands (whoami, pwd, date, echo, clear), and navigated the file system with ls, cd, and cd ~.
  • Built a project folder structure from scratch using mkdir and touch, then managed files like a pro with cp, mv, rm, and rmdir.
  • Wrote a journal entry with the nano text editor, read files with cat, head, and tail, and searched through them with grep and find.
  • Secret Mission: Built a complete DevOps Workspace with a welcome file and backup, generated a file listing with output redirection (>), and wrote and ran your very first Bash script.

Ready to quiz yourself?