Your First Linux Lab

LinuxLinuxBeginner
Practice Now

Introduction

Welcome to LabEx! In this lab, you'll get your feet wet with Linux. We'll cover the famous "Hello, World!" program, some fundamental commands (whoami, id), navigating the terminal, and even installing a handy system monitoring tool. No prior experience is necessary โ€“ we'll walk you through it!

Click the Continue button below or the VM icon on the left to start the lab.

Continue to next step arrow

Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/BasicSystemCommandsGroup(["`Basic System Commands`"]) shell(("`Shell`")) -.-> shell/BasicSyntaxandStructureGroup(["`Basic Syntax and Structure`"]) linux(("`Linux`")) -.-> linux/UserandGroupManagementGroup(["`User and Group Management`"]) linux(("`Linux`")) -.-> linux/PackagesandSoftwaresGroup(["`Packages and Softwares`"]) linux/BasicSystemCommandsGroup -.-> linux/echo("`Text Display`") linux/BasicSystemCommandsGroup -.-> linux/clear("`Screen Clearing`") shell/BasicSyntaxandStructureGroup -.-> shell/comments("`Comments`") shell/BasicSyntaxandStructureGroup -.-> shell/quoting("`Quoting Mechanisms`") linux/UserandGroupManagementGroup -.-> linux/sudo("`Privilege Granting`") linux/UserandGroupManagementGroup -.-> linux/whoami("`User Identifying`") linux/UserandGroupManagementGroup -.-> linux/id("`User/Group ID Displaying`") linux/PackagesandSoftwaresGroup -.-> linux/apt("`Package Handling`") linux/PackagesandSoftwaresGroup -.-> linux/software("`Linux Software`") subgraph Lab Skills linux/echo -.-> lab-270253{{"`Your First Linux Lab`"}} linux/clear -.-> lab-270253{{"`Your First Linux Lab`"}} shell/comments -.-> lab-270253{{"`Your First Linux Lab`"}} shell/quoting -.-> lab-270253{{"`Your First Linux Lab`"}} linux/sudo -.-> lab-270253{{"`Your First Linux Lab`"}} linux/whoami -.-> lab-270253{{"`Your First Linux Lab`"}} linux/id -.-> lab-270253{{"`Your First Linux Lab`"}} linux/apt -.-> lab-270253{{"`Your First Linux Lab`"}} linux/software -.-> lab-270253{{"`Your First Linux Lab`"}} end

Hello LabEx

Let's get your computer to say hello! ๐Ÿ˜„ First up, the terminal. Think of it as your text-based command center for interacting with your computer.

To open the terminal:

  1. Look on the left side of your desktop.
  2. Find the Xfce Terminal icon.
  3. Click it!

The terminal window is where you'll type commands. It's a powerful tool and often a quicker way to accomplish many tasks in Linux than using a mouse.

Now, let's make it say hello! We'll use the echo command. echo simply repeats whatever you tell it to.

The best way to learn Linux (and programming in general) is by doing. Don't just passively read through this โ€“ try things out in the LabEx environment! It's the perfect place to experiment and learn.

Type this command into your terminal exactly as shown:

echo "Hello LabEx"

Press Enter.

Terminal displaying Hello LabEx

You should see "Hello LabEx" appear. Congratulations, you just ran your first Linux command!

Key things to remember:

  • Linux is case-sensitive: echo, Echo, and ECHO are all different.
  • Spaces matter. Make sure there's a space between echo and the quotation mark (").
  • The quotes tell echo precisely what string of text to repeat.

Tips: This Lab is part of the Linux Skill Tree, a structured knowledge system with various skills. After each step, the system verifies your actions, awarding skill points for correct responses ๐Ÿ’ก. Review your accumulated points by visiting the Linux Skill Tree after completing the lab.

Click Continue below to keep going. Labby will automatically verify your work.

Continue to next step arrow

Displaying the Current User

Let's find out who the computer thinks you are.

Type this command and press Enter:

whoami

Tips: Click "Explain Code" at the bottom right of the code block to chat with Labby AI for code clarification. After chatting with Labby, click "Continue" to return to the lab.

This is asking the computer, "Who am I?" It'll respond with your username.

You should see:

labex
Terminal showing whoami output

whoami is useful when you're working on different machines or using different accounts.

Keep going by clicking Continue below.

Displaying User and Group Information

Let's get some more user information with the id command. This is a cool way to see what groups you belong to.

In Linux, users are organized into groups. These groups determine the permissions and access rights a user has.

Type this command and press Enter:

id

You'll see something like:

uid=5000(labex) gid=5000(labex) groups=5000(labex),27(sudo),121(ssl-cert),5002(public)

Don't worry too much about the numbers right now. Here's the breakdown:

  • uid: Your User ID (a unique numerical identifier).
  • gid: Your primary Group ID.
  • groups: All the groups you are a member of.

You can also use id to look up other users. Try:

id root

You'll see:

uid=0(root) gid=0(root) groups=0(root)

root is the superuser โ€“ like the administrator of the system!

Don't be concerned if this seems a bit complex right now. You'll learn more about users and groups as you progress. Remember, practice makes perfect. The more you use these commands in LabEx, the more comfortable you'll become with them!

Click Continue to move on.

htop System Monitor

Let's install a helpful tool called htop. It's like a dashboard that gives you a real-time view of what's happening inside your computer.

In Linux, you typically install software using a package manager. Package managers are similar to app stores for your phone. They simplify the process of finding and installing software.

apt is a widely used package manager for Debian-based systems, such as Ubuntu. First, let's update the list of available packages. This ensures we're installing the latest version of htop. Type this command and press Enter:

sudo apt update
Terminal showing apt update

Next, we'll use sudo apt install to install htop:

  • sudo: Stands for "SuperUser DO." It allows you to execute commands with administrator privileges (temporarily).
  • apt: The tool for installing and managing software.
  • install: Tells apt that we want to install a program.
  • htop: The specific program we want to install.

Type this command and press Enter:

sudo apt install htop
Terminal output of htop install

You might see a message like "htop is already the newest version," which means htop is already installed. That's perfectly fine! You can still run it.

Once it's installed, run htop:

htop

Tips: In LabEx, you can open the terminal using the Xfce terminal on your desktop or the terminal icon in the menu bar. Both options generally have the same functionality.

You'll see a screen packed with information about your computer's activity.

htop system monitor interface

htop shows:

  1. Top: CPU and memory usage, as well as how long your computer has been running (uptime).
  2. Middle: A list of all the running programs (processes).
  3. Bottom: Options for interacting with htop.

Use the arrow keys to navigate.

Press q to exit htop when you're done. The best way to understand htop is to experiment with it! Explore its features and see what you can discover. LabEx provides a safe environment for you to learn.

Click Continue to verify your progress. You'll earn Skill Points for completing this step!

Clear the Screen

Let's clean up the terminal. If it gets cluttered, you can easily clear the screen.

Tips: If you've close the terminal before, you can skip this step and continue.

Type this and press Enter:

clear

Your terminal should now be clean!

This is the final step in your first Linux lab. You've learned how to use the terminal, execute commands, and even install software. Great job!

Click Continue to finish the lab and collect your Skill Points!

Summary

Congratulations! You've completed your first LabEx Lab and taken your initial steps into the world of Linux! You learned how to:

  • Open and use the terminal.
  • Use basic commands: echo, whoami, id, and clear.
  • Install software (htop) using sudo apt install.
  • Monitor your system's performance using htop.

This is just the beginning of your Linux journey! You've seen how powerful even simple commands can be. Ready to take your skills to the next level?

LabEx Pro unlocks a whole new world of learning, including:

LabEx Pro
  • Thousands more interactive labs: Covering everything from basic commands to advanced system administration.
  • Hands-on projects: Build real-world skills and confidence.
  • Expert support: Get help whenever you need it.
  • Skill Tree and achievements: Build a strong foundation for a career in tech.

Continue your Linux adventure with more free labs, or upgrade to LabEx Pro and become a Linux expert faster!

Other Linux Tutorials you may like