How do I navigate the file system in the command prompt?

How do I navigate the file system in the command prompt?

How do I list the files in my “present working directory”?

For Mac OS X and Linux we use the “ls” command. i.e. (for windows we use “dir” instead)

How do we work out what our current directory is? For Mac OS X and Linux we can use the pwd command:

What does pwd stand for - “present working directory”.

How do we change our present working directory?

For this we use the change directory command which is cd. Here are some examples

  • cd ~/

    • This means change the home directory that you are logged in as.

  • cd

    • With nothing at all this will change to the home directory - so it’s like just cd ~/

  • cd <sub directory name>

    • Change to a directory which is under your current directory.

  • cd ..

    • Change up one directory

We can also move to a directory in an arbitrary part of the file system. This is called an “absolute path”. It starts with the / slash character at the beginning. See understanding file paths.

Here’s a screen shot showing some examples: