I’m supposed to navigate to the
/home/ccuser/workspace/blog/2015 directory so I can continue with this exercise, but I navigated somewhere I didn’t mean to. How can I find my bearings and get to where I need to be?
Always be sure to keep in mind two things when navigating the command line:
- Your current location (
- Available directories to
cd into (
This should keep you on track, and is generally just good practice.
But! If you are already ‘lost,’ there’s still hope. In this case, we have a file tree structure handy, which shows you the entire directory structure and should help you find your way around.
Just keep in mind: Using
cd .. goes up one level, so if you’re already inside of the ‘jan’ directory, for example, and go up one level, you will then be in the ‘2015’ directory, and will have access to ‘jan’, ‘feb’, and ‘motherboard.txt.’
Why do I keep getting this error message whenever I try this command?
$ cd 2015
bash: cd: 2015: No such file or directory
it means no directory named 2015 exists within the current working directory.
you can use
pwd to verify what your current working directory is, and
ls to see the files and directories within the current working directory
It means you are in the wrong directory. Imagine you are in a room, and there are 3 doors available. You want to go through the door that is called 2015. But you entered the wrong room, so you can’t go through that door as none of those doors have the name (that door doesn’t exist there).
You have to retrace your steps in the house, for example, by typing ‘cd …’ repeatedly, until you come into the hallway that will lead you towards the right room. By using pwd you can see where you are, and by using the file structure, you can see where you have to go. Then you cd ‘‘directory’’ until you come to the right room that has the door called 2015.
Thank you. This analogy really helped me out, I was stuck for bit in Xubuntu command terminal.
- Available directories to cd into (pwd)
Is this a typing error? The tutorial says it should be ls?
I am having some issues with commands like cd… They dont seem to work. Am I doing smth wrong ?
What specifically are you doing with
cd? What sort of error messages (if any) or issues are you having?
You’re not wrong in the sens that
ls would allow you to see all the files within a specific directory to
cd into, but I think @contentmazzone was referring that
cd only works when you know where you’re already located with
I hope I’m making sense and @contentmazzone, please correct me if I’m wrong.!
To go to 2015 if you don’t know where in the tree you are, you can type the full path.
$ cd /home/ccuser/workspace/blog/2015
You must check few things first:
- current working directory using ‘pwd’
- all directories in the directory by using ‘ls’
- You are typing correct command syntax ( directory you want to navigate to)
Usage: cd directory
- The directory you are trying to navigate exists actually
This lesson talks about program as argument. What is this program and why do we have to use it as argument
The instruction say:
- The directory we change into is
2015 . When a file, directory or program is passed into a command, it is called an argument . Here the 2015 directory is an argument for the
I find the term program confusing here. The crucial take away here is that
2015 is an argument for the