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 filesystem and run built-in programs or custom scripts. In Unix, the command line interface is called Bash, and the shell prompt is the $.

ls List

$

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.

pwd Print Working Directory

$

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

cd Change Directory

$

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.

mkdir Make Directory

$

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.

touch Create New File

$

The shell command touch 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? $ ls 2014 2015 hardware.txt 1. In the terminal, fir…
  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
    $ pwd /home/ccuser/workspace/blog pwd stands for “print working directory”. It outputs the name of the directory you are currently in, called the working directory. Here the working directo…
  5. 5
    $ cd 2015 1. cd 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 w…
  6. 6
    $ cd jan/memory To navigate directly to a directory, use cd with the directory’s path as an argument. Here, cd jan/memory/ command navigates directly to the jan/memory directory. $ cd .. …
  7. 7
    $ mkdir media The mkdir 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 mkdir t…
  8. 8
    touch keyboard.txt The touch 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. Her…
  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