Learn

Our next command is cd, which stands for “change directory.” Just as you would click on a folder in Windows Explorer or Finder, cd switches you into the directory you specify. In other words, cd changes the working directory.

Let’s say the directory we change into is 2015/:

$ cd 2015

When a file, directory, or program is passed into a command, it is called an argument. Here the 2015/ directory is an argument for the cd command.

The cd command takes a directory name as an argument and switches into that directory.

It is also important to move up one directory. For this, we use:

$ cd ..

The argument .. stands for the directory above the current working directory. Assuming we are in /home/ccuser/workspace/blog/2015:

$ pwd /home/ccuser/workspace/blog/2015 $ cd .. $ pwd /home/ccuser/workspace/blog

The above example uses the command cd .. to navigate up to the /home/ccuser/workspace/blog/ directory.

Instructions

1.

Our current working directory is /home/ccuser/workspace/blog/. Change into the 2015/ directory.

Confirm you are in the 2015/ directory using pwd.

Make sure to click the Check Work button once you’ve completed each checkpoint.

2.

Now move back up to the blog/ directory using the .. notation.

Confirm your location again with pwd and click the Check Work button?

3.

Let’s move further into the filesystem. We are currently in the blog/ directory. From here we want to move into the 2015/ directory, then into a directory named jan/ and lastly, a directory named memory/. (You can reference the filesystem for this lesson here.)

Move down the filesystem into the memory/ directory and print the working directory again to see the new location.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?