Key Concepts

Review core concepts you need to learn to master this subject

Print Working Directory pwd

$ pwd /Users/sonny/Downloads

The shell command pwd displays the file path from the root directory to the current working directory.

Make Directory mkdir

$ pwd /Users/sonny/Downloads

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.

List ls

$ pwd /Users/sonny/Downloads

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.

cd Change Directory

$ pwd /Users/sonny/Downloads

The shell command cd can be used to move throughout the filesystem of a computer. It accepts a variety of arguments:

  • Full file paths.
  • Names of children of the current directory.
  • .. the parent of the current directory.

Filesystem Structure

$ pwd /Users/sonny/Downloads

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.

touch Create New File

$ pwd /Users/sonny/Downloads

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

The Command Line

$ pwd /Users/sonny/Downloads

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

Helper Commands

$ pwd /Users/sonny/Downloads

Helper commands for the command line include:

  • clear to clear the terminal
  • tab to autocomplete the line
  • and to cycle through your previous commands
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 and passes them on to the computer’s operating system to run. From the command line, you can navig…
  2. 2
    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…
  3. 3
    The first command we’re going to look at is ls. A command is a directive to the computer to perform a specific task. When you type ls, the command line looks at the directory you are in, and then…
  4. 4
    The next command we’re going to look at is pwd, which stands for “print working directory.” It outputs the name of the directory you are currently in, called the working directory. Here the wor…
  5. 5
    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 ch…
  6. 6
    Instead of using cd twice in order to move from 2015 to memory, we can use it once and give it a longer argument: $ cd jan/memory To navigate directly to a directory, use cd with the dir…
  7. 7
    Now that we can traverse the existing filesystem, let’s try editing it by making directories (folders) through the command line. The command for that is mkdir: $ mkdir media The mkdir command st…
  8. 8
    Now we know how to create directories through the command line, but how do we create new files? We can do this using the command touch: $ touch keyboard.txt The touch command creates a new fil…
  9. 9
    Now that we’ve covered the basics of navigating your filesystem from the command line, let’s look at some helpful commands that will make using the command line easier! clear is used to clear you…
  10. 10
    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