Bean Huang
Bean Huang

Reputation: 159

"Change Directory" Command doesn't work in Mac terminal

I'm learning python by myself on my Mac. I downloaded a folder to my desktop called ExercisesFiles and it has a subfolder called Chap01. And Chap01 has a python file called 01_03.py. Now I open a Mac terminal and tried to write some commands to open the 01_03.py file. I wrote down:

cd Desktop/ExerciseFiles/Chap01

Then the terminal tells me:

-bash: cd: Desktop/ExerciseFiles/Chap01: No such file or directory

I can't figure out why the terminal doesn't allow me to change directory? I look up the Mac terminal commands and I believe my commands are right. Thank you.

Upvotes: 1

Views: 13001

Answers (1)

cohnred
cohnred

Reputation: 101

Perform pwd for checking current working directory. Maybe you're not in user's home dir. If you want to go to Desktop from any place, you can exec cd ~/Desktop/. In this case, ~ makes sure that you're in logged-in-user's home dir. Adjust this command accordingly for your needs.

Upvotes: 3

Related Questions