0
0
Linux CLIscripting~15 mins

Why file system navigation is the first skill in Linux CLI - See It in Action

Choose your learning style9 modes available
Why file system navigation is the first skill
📖 Scenario: Imagine you just started using a new computer with Linux. You want to find your documents, pictures, and other files. To do this, you need to learn how to move around the computer's file system. This is like walking through rooms in a house to find what you need.
🎯 Goal: Learn how to navigate the Linux file system using basic commands. You will practice moving between folders, checking where you are, and listing files. This is the first and most important skill to use the command line effectively.
📋 What You'll Learn
Create a variable called current_path that stores the current directory path.
Create a variable called home_path that stores the path to the home directory.
Use the cd command to change directories to the home directory stored in home_path.
Use the ls command to list files in the current directory.
Print the current directory path stored in current_path.
💡 Why This Matters
🌍 Real World
Navigating the file system is like walking through folders on your computer. It helps you find files and run programs easily.
💼 Career
Every job that uses Linux or command line tools requires knowing how to move around the file system quickly and confidently.
Progress0 / 4 steps
1
Set up current directory path
Create a variable called current_path and set it to the output of the pwd command, which shows the current directory path.
Linux CLI
Need a hint?

Use $(pwd) to get the current directory path and assign it to current_path.

2
Set up home directory path
Create a variable called home_path and set it to the path of the home directory using ~.
Linux CLI
Need a hint?

The home directory can be represented by ~. Assign it to home_path.

3
Change directory to home
Use the cd command with the variable home_path to change the current directory to the home directory.
Linux CLI
Need a hint?

Use cd "$home_path" to move to the home directory stored in home_path.

4
List files and print current directory
Use the ls command to list files in the current directory. Then, update current_path with the new directory path using pwd and print it using echo.
Linux CLI
Need a hint?

Use ls to see files, then current_path=$(pwd) to update the path, and echo "$current_path" to print it.