Mac Hardware forum

Question

Change directories in Terminal

by James_Stodder / July 15, 2012 12:43 PM PDT

I have a new file placed ("fileX") in what I think is my "Home" directory -- the space where the Documents and Movies and Applications sit. However, when I go to the Directory space and give the "cd fileX" command, it tells me the file is not recognized. What am I doing wrong?

Answer This Ask For Clarification
Discussion is locked
You are posting a reply to: Change directories in Terminal
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Change directories in Terminal
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.

All Answers

Collapse -
chdir command doesn't exist
by James_Stodder / July 16, 2012 2:04 AM PDT
In reply to: Did you try chdir?

I did try it, but my MacPro tells me the command doesn't exist. When i do the 'cd' command followed by the filename, it tells me that the *file* doesn't exist. So i'm wondering (from my Windows experience) whether i need to specify a PATH to that file. As i said, i placed it in what seems to be the "Home" directory, where documents, movies, and applications also sit.

Collapse -
Is this a new problem?
by R. Proffitt Forum moderator / July 16, 2012 2:13 AM PDT

As in, "it worked before?"

I can't tell if you are new to the UNIX command line or not. Before I could cd years ago I had to alias cd to the chdir command. And if you are new to UNIX in general, my last sentence would not make any sense.

So without knowing where you are in your journey I suggest you ls first so you can see the names of the folders before you try to cd there. And in all known UNIX case matters. Home is not the same as home.

Sorry but you may have to reveal a little here.
Bob

Collapse -
New to Unix
by James_Stodder / July 16, 2012 7:20 AM PDT
In reply to: Is this a new problem?

I have no particular background in UNIX. I am used to working in a Windows environment, with the c:\ prompt at the base level. The instructions i'm working with are for learning the programming language Python in a Mac environment. Here is the instruction we're responding to:

MacCreate a folder on your computer to use for your Python programs. A good suggestion would be to name it pythonpractice and place it in your Home folder (the one that contains folders for Documents, Movies, Music, Pictures, etc). Save your hello.py program into this folder.Open the Applications folder, go into the Utilities folder, and open the Terminal program.Type cd pythonpractice to change directory to your pythonpractice folder, and hit Enter.Type python hello.py to run your program!

<div>This is found under the "Mac" heading in:


http://en.wikibooks.org/wiki/Python_Programming/Creating_Python_programs

</div>
I've done all this successfully in my 'home' system of Windows, and now am trying to help my son who's using a Mac Pro. Thanks for trying to help!

Collapse -
new to Unix
by James_Stodder / July 16, 2012 7:25 AM PDT
In reply to: Is this a new problem?

Yes, i'm basically a Windows guy. I'm trying to help my son learn some Python programming. Here's the instruction we're responding to, under
http://en.wikibooks.org/wiki/Python_Programming/Creating_Python_programs

MacCreate a folder on your computer to use for your Python programs. A good suggestion would be to name it pythonpractice and place it in your Home folder (the one that contains folders for Documents, Movies, Music, Pictures, etc). Save your hello.py program into this folder.Open the Applications folder, go into the Utilities folder, and open the Terminal program.Type cd pythonpractice to change directory to your pythonpractice folder, and hit Enter.Type python hello.py to run your program!


Thanks a lot for trying to help!

Collapse -
Link, comment
by R. Proffitt Forum moderator / July 16, 2012 7:47 AM PDT
In reply to: new to Unix
http://www.python.org/getit/mac/ may be out of date but it appears you don't need to install python.

Now that we know where you are in the process try

pwd

To see what your current folder is. And

ls

Or

dir

To see what's in that folder that you are in. You can't cd to a folder that isn't there.
Bob
Collapse -
Python help
by James_Stodder / July 27, 2012 12:13 PM PDT
In reply to: Link, comment

Thanks for our help, Bob. My son finally figured it out.

Collapse -
Answer
Also.
by R. Proffitt Forum moderator / July 15, 2012 12:52 PM PDT

If a folder has a space in it, you can quote it.

chdir "this folder"

Popular Forums
icon
Computer Help 49,613 discussions
icon
Computer Newbies 10,349 discussions
icon
Laptops 19,436 discussions
icon
Security 30,426 discussions
icon
TVs & Home Theaters 20,308 discussions
icon
Windows 10 360 discussions
icon
Phones 15,802 discussions
icon
Windows 7 7,351 discussions
icon
Networking & Wireless 14,641 discussions

Tech explained

Do you know what an OLED TV is?

CNET explains how OLED technology differs from regular TVs, and what you need to know to make the right shopping decision.