Conquer The Command Line: The cd Command

Jim Homme
2 min readDec 8, 2020

--

F

How to use the Linux cd command plus essential options

In this installment of “Conquer The Command Line” we talk about how to use the Linux cd command.

Whenever you want to point to a new directory, type cd <directory>, where <directory> is the directory you want to work with. cd will move you into that directory.

When you use cd to move into a new directory, the prompt may change to reflect that you have done so. You can also use the command to display the directory you have moved to.

Memory Aid: Think “change directory”

Essential Options

I was unable to find any special options for cd, because it’s such a simple command. It does as advertized: move you to a new directory.

Special Directory Names

Notice that when I introduced cd, I talked about it with a directory name after it. That's because when you type cd by itself, it moves you to your home directory. Your home directory is the place where the system keeps the files and directories that belong to you. Linux has some special names for directories. Here are some examples of cd commands that use them:

  • cd ..: move toward the root by one folder. The root is /. For Windows users, think of this as the current drive with no directory name after it.
  • cd ~: go to your home directory, same as cd by itself.
  • cd -1: go to the last directory you were working with.

Linux has another special name for a directory, ., which points to the current directory, but you wouldn'w want to use cd to go there, since you'd already be there.

What Now?

Hopefully this post has helped you take one more step in conquering the command line. I welcome any feedback.

This post was originally written at https://www.jimhomme.com

--

--

Jim Homme

Musician, father of three, husband. Information Technology veteran. Bookworm. Chess player. Accessibility consultant. Plain language advocate