Navigating the File System

Get up and running with the command line by navigating directories and files.

Start[missing "en.views.course_landing_page.learn-the-command-line.course_illustration" translation]

Key Concepts

Review core concepts you need to learn to master this subject

The Command Line

$

The command line allows a user to navigate the file system, and run built in programs or custom scripts. In Unix, the command line interface is called Bash, and the shell prompt is the $.

Listing Files and Folders

$

The shell command ls is used to list the contents of directories. If no arguments are given, it will list the contents of the current working directory.

Filesystem Structure

$

A computer's filesystem organizes the data stored by a computer, so that it can be easily retrieved by the user. Files are typically represented by a tree-like structure, in which any parent directory can have any number of children. The root directory is then found at the base of the tree.

Printing the Working Directory

$

The shell command pwd displays the file path from the root directory to the current working directory. In the example above, pwd was used from inside John Doe's Downloads folder.

Changing Directories

$

The shell command, cd can be used to move throughout the filesystem of a computer. It accepts a variety of arguments, from full file paths, to the names of children of the current directory, to .. which stands for the parent of the current directory.

Making Directories

$

The shell command mkdir can be used to make a new directory in the filesystem according to its argument. If a file path is given, the new directory will be placed at the end. Otherwise it will create a new directory in the current working directory with the name given.

Creating New Files

$

The touch shell command creates a new file in the current working directory with the name provided.

Navigation
Lesson 1 of 1
  1. 1

    The command line is a text interface for your computer. It's a program that takes in commands, which it passes on to the computer's operating system to run. From the command line, you can navi...

  2. 2

    What's going on here? [...] 1. In the terminal, first you see [...] . This is called a shell prompt. It appears when the terminal is ready to accept a command. 2. When you type [...] , the ...

  3. 3

    A filesystem organizes a computer's files and directories into a tree structure: 1. The first directory in the filesystem is the root directory. It is the parent of all other directories and fil...

  4. 4

    [...] [...] stands for "print working directory". It outputs the name of the directory you are currently in, called the working directory. Here the working directory is blog/. In Codec...

  5. 5

    [...] 1. [...] stands for "change directory". Just as you would click on a folder in Windows Explorer or Finder, [...] switches you into the directory you specify. In other words, [...] ch...

  6. 6

    [...] To navigate directly to a directory, use [...] with the directory's path as an argument. Here, [...] command navigates directly to the jan/memory directory. [...] To move up on...

  7. 7

    [...] The [...] command stands for "make directory". It takes in a directory name as an argument, and then creates a new directory in the current working directory. Here we used [...] to cr...

  8. 8

    [...] The [...] command creates a new file inside the working directory. It takes in a filename as an argument, and then creates an empty file in the current working directory. Here we used ...

  9. 9

    Congratulations! You've learned five commands commonly used to navigate the filesystem from the command line. What can we generalize so far? The command line* is a text interface for the comput...

What you'll create

Portfolio projects that showcase your new skills

Pro Logo

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo

Navigating the File System

Start[missing "en.views.course_landing_page.learn-the-command-line.course_illustration" translation]