Command line interface - making and retrieving directories

I am not getting any output from the pwd ls nor the pwd cd ~ prompts (page 248) Could anyone please help me by pointing out what my mistake(s) is(are)? I have not been able to advance to the section that deals with retrieving directories.
The below code is what I have on my terminal.
Many thanks in advance for guidance
Ijemusne

ijeomas-MacBook-Pro:~ ijeomaajufo$ 
ijeomas-MacBook-Pro:~ ijeomaajufo$ pwd ls
/Users/ijeomaajufo
ijeomas-MacBook-Pro:~ ijeomaajufo$ mkdir temp
mkdir: temp: File exists
ijeomas-MacBook-Pro:~ ijeomaajufo$ mkdir stuff
ijeomas-MacBook-Pro:~ ijeomaajufo$ mkdir things
ijeomas-MacBook-Pro:~ ijeomaajufo$ mkdir ijeoma
ijeomas-MacBook-Pro:~ ijeomaajufo$ mkdir frank
ijeomas-MacBook-Pro:~ ijeomaajufo$ mkdir joe
ijeomas-MacBook-Pro:~ ijeomaajufo$ mkdir alex
ijeomas-MacBook-Pro:~ ijeomaajufo$ mkdir john
ijeomas-MacBook-Pro:~ ijeomaajufo$ pwd ls
/Users/ijeomaajufo
ijeomas-MacBook-Pro:~ ijeomaajufo$ pwd cd ~
/Users/ijeomaajufo
ijeomas-MacBook-Pro:~ ijeomaajufo$ pwd ls
/Users/ijeomaajufo
ijeomas-MacBook-Pro:~ ijeomaajufo$ cd ~ john
ijeomas-MacBook-Pro:~ ijeomaajufo$ pwd cd ~
/Users/ijeomaajufo
ijeomas-MacBook-Pro:~ ijeomaajufo$ mkdir temp/stuff
mkdir: temp/stuff: File exists
ijeomas-MacBook-Pro:~ ijeomaajufo$ mkdir stuff/things
ijeomas-MacBook-Pro:~ ijeomaajufo$ pwd ls
/Users/ijeomaajufo
ijeomas-MacBook-Pro:~ ijeomaajufo$ mkdir "I have fun
> cd temp
> cd "I have fun
ijeomas-MacBook-Pro:~ ijeomaajufo$ cd "I have fun"
-bash: cd: I have fun: No such file or directory
ijeomas-MacBook-Pro:~ ijeomaajufo$ cd "i have fun
> mkdir "I have fun"
> pwd cd ~
> pwd
> pwd ls
> pwd ls cd ~
> pwd
> pwd ls
> cd ~
> cd temp
> pwd
> cd ~
> 
> pwd users/ijeomaajufo
> 
> 

cd means change directory so you have to tell it where to change to afterwards:

cd new_dir

Or longer paths:

cd new_dir/another_dir_inside

Using the tilder needs a forward-slash and means ‘current user’ so you don’t have to type the full path of your name from root.

cd ~/new_dir/another_dir_inside

Present working directory pwd just means ‘hey where have I navigated too, and what directory am I in?’. It is a command on its own and doesn’t need anything after it.

A common pattern is:

>>> ls
>>> cd somewhere
>>> ls
>>> cd somewhere_deeper
>>> ls 
>>> pwd
>>> cd

This can be described as:
What’s in here?
Ah that directory! Go into that…
What’s in here?
Ah another directory, go into that…
What’s in here?
Not what I wanted. Crap! Where am I now in my file system?
Sod it, change directory back to my root folder!

1 Like

Thanks very much for your guidance, gpkesley. I’ve got the concept now!

1 Like