Understanding Your Current Location
In Linux, it is important to always know your current location in the filesystem. This first step will teach you how to determine your current directory and how to create a new directory.
Checking Your Current Directory
The pwd
command (Print Working Directory) displays the full path of your current location in the filesystem:
pwd
You should see output similar to:
/home/labex/project
This means you are currently in the project
directory, which is inside the labex
user's home directory.
Creating a New Directory
Now that you know your current location, let's create a new directory called resources
using the mkdir
command (Make Directory):
mkdir resources
This command creates a new directory called resources
inside your current directory. The command does not produce any output if successful.
To verify that the directory was created, you can list the contents of your current directory using the ls
command:
ls
You should see resources
listed in the output.
Changing Directories
Now that we have created a new directory, let's navigate into it using the cd
command (Change Directory):
cd resources
This command changes your current directory to resources
. Like mkdir
, the cd
command does not produce any output if successful.
To verify that you have successfully changed directories, use the pwd
command again:
pwd
You should now see:
/home/labex/project/resources
This confirms that you are now in the resources
directory.