Throughout your life as a web developer, you will be using the command line a lot. It's really useful to get used to these commands now, since they will enable you to navigate directories easily.
Let's get ready to learn some commands! This lesson is going to be an overview of the commands used most. It won't cover all of the commands, but only the necessary ones to get you started.
Here is a list of the commands we will be covering:
mkdir
- make directory (create a folder)ls
- list directory contents (list the contents of the directory)cd
- change directorypwd
- print working directory (print the directory you are working in)First, let's create a new folder called ruby_fundamentals
. We can do this by typing the following in the command line:
mkdir ruby_fundamentals
mkdir
stands for Make Directory. With this command, you can create a new folder.
Now let's navigate to this folder that we just created.
cd ruby_fundamentals
The cd
command is perhaps the command that you will use most. cd
stands for Change Directory. We use it when we want to navigate to different directories in the terminal.
Now let's print the directory that we are currently in right now.
pwd
pwd
stands for Print Working directory. You can use whenever you need to know which directory you are in.
Let's move back to our original directory. We can move one directory up with this command:
cd ..
As you can see, typing ..
will direct you to the directory above the current directory.
Let's now list all of the contents that exist in this directory:
ls
ls
stands for list directory contents. Developers use the ls
command whenever they want a quick look at the folders in the current directory.
Now let's navigate back to our ruby_fundamentals
folder:
cd ruby_fundamentals
Let's list the content of our directory:
ls
In this lesson, we have briefly introduced the main commands you will be using in the beginning stages of your web development career.
There are more commands that you can pick up along the way, but these are essential commands that every developer must know.