Welcome to Session 2! Now that you know how to establish a secure, encrypted text connection (SSH) to a remote Linux server, it's time to learn how to move around and build things inside it.
In this 45-to-60 minute session, you will learn the "Survival Commands" of Linux. Think of this as learning how to use your computer's "File Explorer" or "Finder," but using simple text commands instead of double-clicking your mouse.
Prerequisites
- A laptop connected to the internet.
- You must have completed Session 1 and know how to log into your remote Linux sandbox.
- Log in now using PuTTY (Windows) or Terminal (Mac) so you are looking at your prompt:
student1@linux-sandbox:~$
Core Concepts: The Linux File Tree
In Windows, your files are stored in drives like C:\Users\YourName\Documents.
In Linux, everything is organized like a giant branching tree starting from the root trunk, represented by a single forward slash /.
/(The Root Trunk): The master folder containing all other folders and files on the entire machine./home(The Neighborhood): The folder where all user accounts live./home/student1(Your House): Your private user folder (also known as your Home Directory). When you log in, you are automatically placed inside your house.
Step-by-Step Guide
Step 1: Finding Your Current Location (pwd)
When you are inside a text terminal, there are no visual folders to look at. To prevent getting lost, use the map command.
- Type the following command and press Enter:
pwd- What this does: print working directory. It asks the server: "What folder am I currently standing in?"
- Verify Output: You should see:
/home/student1
Step 2: Listing the Directory Contents (ls)
Now let's look around your "house" to see what files are lying around.
- Type the following command and press Enter:
ls- What this does: list. Shows the names of the folders and files in your current directory.
- If this is a fresh account, you might see nothing, or perhaps some default system folders.
- Now let's run a "detailed" list. Type this exact command and press Enter:
ls -la- What this does: The
-lmeans "long format" (shows file sizes and dates), and-ameans "all" (shows hidden configuration files). Hidden files in Linux always start with a dot (like.bashrc).
- What this does: The
Step 3: Creating a New Folder (mkdir)
Let's build a dedicated drawer for our upcoming website.
- Type the following command and press Enter:
mkdir my-first-website- What this does: make directory. Creates a brand new folder named
my-first-websiteinside your current location.
- What this does: make directory. Creates a brand new folder named
- Confirm that the folder was created by running the list command again:
ls- You should see
my-first-websiteprinted on your screen (usually highlighted in blue, representing a folder!).
- You should see
Step 4: Walking Into Your New Folder (cd)
Right now, you are standing in /home/student1, looking at the new folder. Let's walk inside it.
- Type the following command and press Enter:
cd my-first-website- What this does: change directory. Walks you directly inside the
my-first-websitefolder.
- What this does: change directory. Walks you directly inside the
- Verify your new location on the system map:
pwd- You should now see:
/home/student1/my-first-website
- You should now see:
Step 5: Creating Your First Text File
Since we are inside an empty folder, let's create a text file and write some simple words inside it.
- Type this command exactly (including the quotation marks and the angle bracket) and press Enter:
echo "Hello, I am a future Systems Architect!" > hello.txt- What this does:
echorepeats whatever words are inside the quotes. The>symbol is like an arrow that directs that text into a new file namedhello.txtinstead of printing it to the screen.
- What this does:
- List the folder contents to verify the file was created:
ls- You should see
hello.txtlisted.
- You should see
Step 6: Reading the File Contents (cat)
Let's read our new file to verify the text was saved.
- Type this command and press Enter:
cat hello.txt- What this does: concatenate. Opens the file and spits out its text content directly on your terminal screen. You should see "Hello, I am a future Systems Architect!" printed.
Step 7: How to Safely Walk Backwards
What if you want to leave this folder and go back to your main house folder?
- Type this command exactly (make sure to include the space and the two dots) and press Enter:
cd ..- What this does: The two dots
..represent the "parent folder" (the folder directly above you). This command steps you back out by one level.
- What this does: The two dots
- Verify your position:
pwd- You should be back in
/home/student1.
- You should be back in
Step 8: Deleting files (rm)
⚠️ CRITICAL WARNING: Linux does not have a "Recycle Bin" or "Trash Can." When you delete a file in Linux, it is gone forever instantly. Be extremely careful.
- Let's go back into our folder first:
cd my-first-website - Let's create a temporary file we want to delete:
echo "This is garbage" > garbage.txt - Now let's delete it. Type this and press Enter:
rm garbage.txt- What this does: remove. Erases
garbage.txtpermanently.
- What this does: remove. Erases
- Run
lsto verify thatgarbage.txtis gone, buthello.txtis still safe.
Verification: Did it work?
To ensure you have mastered directory navigation and file creation:
- You can run
pwdand see you are inside/home/student1/my-first-website. - Running
lsshowshello.txt. - Running
cat hello.txtdisplays your custom message.
To close your terminal connection, type:
exit
What's Next?
Incredibly well done! You now know how to move, create folders, write files, and inspect files directly inside a remote Linux machine.
In Session 3, we will leave the raw terminal temporarily and set up a state-of-the-art visual, cloud-based IDE (Integrated Development Environment) called Google Antigravity to build our actual, beautiful website code!