/ factorpad.com / tech / linux-essentials / cd-command.html
An ad-free and cookie-free website.
Beginner
To change directories at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux cd Command Summary with Examples (3:39)
Our eighth word, or command to memorize is cd
from the category Navigation.
cd
allows you to change
the current directory. In our last two videos we used
pwd
to print the working directory,
then ls
to list files, now it's time
for a command to explore Linux directories.
-options | description |
---|---|
|
Options are infrequent |
It may help to think of commands as mini programs and most follow this
structure:
command -option(s) argument(s)
.
The cd
command has only
3 options and the interesting stuff is in the
arguments, so we'll spend more time in the terminal.
Before that, note, there are absolute and relative references.
Absolute means you use cd
to change
directories from the root, and relative means you change directories
from where you sit.
So why is cd
an important command?
Well, cd
is the main command for
moving around.
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows 10.
Here we go, start with pwd
to find
out where you are currently.
Next, let's try an absolute reference. Type
cd /bin
and try the
ls
from video 7 and see if any files
look familiar.
Now, to use cd
for relative path
changes just know that one dot .
means the current directory and two dots
..
means one directory above. So if
we do cd ..
and
cd ..
, where does that take you?
To the root.
And last, because we only have time to scratch the surface with
cd
here, in the description below
please find a link to the
Linux Cheat
Sheet, that supplements this
series. There you will find a description of about 20 standard
directories on most Linux distributions. As homework, please use this
to navigate around.
Okay now you know how to use cd
.
And you know the syntax for commands, options and arguments.
One last tip about the cd
command.
If you can't find a tidy help manual for
cd
, which is common, we'll help you
in our next video.
Okay, thanks for visiting today. I hope this was a fun introduction
to the cd
command.
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Subscribe at YouTube and follow @factorpad to be notified about new opportunities to learn.
cd
command,
hit Back.cd
and move on to tutorial #9 on
bash
, click Next./ factorpad.com / tech / linux-essentials / cd-command.html
A newly-updated free resource. Connect and refer a friend today.