Learn the cd command! As one of the most commonly used and needed commands, understanding it's full potential will give you a better command of filesystems! Please Visit Me at: www.HatBoySoftware.com
Jake Corn - JakeCornCodes@gmail.com
3. “ls” to list all the contents of the current directory so
that we can see where we want to change
directory into.
4. “cd” (Change Directory) into the Desktop directory by typing
“cd Desktop”. This works for any directory that’s within the
current directory. SYNTAX: cd dirName
5. To Change Directory (cd) into a directory that has a
space in its name, place the folder’s (directory’s)
name in quotation marks (“folder name”). This
makes it so that the “cd” command sees the two
words as one argument.
6. In this example I first attempted to Change Directory by simply typing my folder. It
didn’t work because there is no directory (folder) with the name of “my”. So it threw an
error. I corrected this by putting the “directory name” in quotation marks. I could’ve
also used the escape character before the space to tell the program to ignore space
7. Typing “..” after a filesystem command
references the “Parent Directory”. What
we are saying here is…
Change Directory into the “Parent
Directory”.
Parent Directory - the directory our
working directory is in.
8. To teach the next slide I need to first show the
order of directories we’ll be working with.
“my folder” is in the “Desktop” directory…
“Tutorials” is in the “my folder” directory..
9. In this Command what I was wanting to do was to change
into the “Tutorials” directory which is a “sub-directory” of
the “my folder” directory -- which is a “sub-directory” of the
“Desktop” directory.
“cd” dirName/subDirName
10. If we want to get back to the “parent’s parent
directory” we just change directory (cd) and
provide it the argument of “../..”. You may
remember that “..” changes our directory to the
parent directory….so this is just an extension of
that concept.
11. A useful shorthand for Changing Directory into the
“home (user)” directory is to simply type “cd” all by
itself.
12. You can also provide “cd” with a tilda “~” to
change to the “home” directory.
2 ways, same thing.
13. Root Directory - The directory which has no parent.
To change into the root directory from anywhere, provide “cd”
with an argument of “/”.
“cd /”
14. Absolute Path:
Wherever you are in the filesystem, you can always provide
the “cd” command with the “absolute file path” to the directory
you’re wanting to change into.
Absolute file path HAS to start with “root” - /