Skip to main content

Terminal commands

Navigation#

Each of your terminal windows can view one directory/folder at a time. To view multiple directories, open more terminal windows.

You only need to learn a few commands to navigate your files in a bash terminal.

  1. mkdir <directory> creates a new directory with the name you specify. For example, mkdir testdir creates a new directory called testdir.

  2. cd <directory> changes the directory you are in to the directory you specify. For example, cd testdir moves you into the testdir directory.

    1. cd .. moves you up one directory
    2. cd ../../ moves you up two directories
    3. cd ~ moves you back to the home directory
  3. nano <path/to/file> creates an editor at the file. For example, type nano README.md to open the README.md file or to create one if it doesn't exist in that directory

    1. Press Ctrl+O to initiate writing the file out
    2. Press Enter to write the file out
    3. Press Ctrl+X to close the file
  4. ls lists the items in your current directory

  5. rm <path/to/file> deletes the file you specify

    1. For example, rm README.md deletes the README.md file
    2. rm -rf <directory> deletes the directory you specify
warning

Deleting files and directories in the Ubuntu WSL is permanent because there's no recycle bin.