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.
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.
- remove the file
- create the directory
- navigate to directory
Adding to what @stetim94 said, remember that
rmdir is the command to remove directories. If you are working with files, you need to use
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
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?
One easy way is using flags when you call the
ls command. If you do:
$ ls -l
-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