Daily Buzz Exercise, Cannot Change Directories

Exercise Link

On this exercise, I’m instructed to navigate to a directory I’ve just created, but the command isn’t working. It claims that the directory does not exist when I attempt to navigate to or remove it, but it simultaneously claims that I cannot create a directory with the name ‘elections’ because it already exists. As seen in my screenshot, I am in the proper directory, and it appears when listing the available directories. I simply can’t interact with it.

Any thoughts?

you can’t have a file and a directory with the same name. elections seems to be a file, while it should be a directory.

You should:

  1. remove the file
  2. create the directory
  3. navigate to directory
1 Like

Adding to what @stetim94 said, remember that rmdir is the command to remove directories. If you are working with files, you need to use rm instead.

I assumed people now how to remove a file, and know what rmdir is (given dir is an abbreviation of directory) or are able to use man or --help

1 Like

Oh, I see. Thank you! I’m actually just getting started out (this is only my first time using the command line), so I appreciate the help. Is there a way to find out whether something is a file or a directory if it lacks an extension?

1 Like

One easy way is using flags when you call the ls command. If you do:

$ ls -l

that -l means you want the output in “long list format”, and it will give you much more information. You’ll get an output similar to this:

Now, pay attention to the first letter in each row. You can have:
- : the item is a file
d : the item is a directory

Hope this clarifies it a bit! Check out this source that explains in more detail the way you can use ls -l

2 Likes