LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   cd command and "No such file or directory" error (https://www.linuxquestions.org/questions/linux-newbie-8/cd-command-and-no-such-file-or-directory-error-794303/)

runinguy 03-09-2010 03:20 PM

cd command and "No such file or directory" error
 
Hello all, and sorry in advance if this is the wrong place for this question.

I am an extremely inexperienced user of command line computing (I am working with Terminal.app on Mac OS X Snow Leopard) who is trying to compile Fortran code with the G95 compiler. I have created a folder within the G95 directory that I would like to use for storing all of my code files, but when I try to cd from the G95 directory to the new one that I created, I get the above error. I can cd to other folders within the G95 directory, and have tried all combination's of capitalization.

Any help or insight, or advice on how to learn this stuff better would be greatly appreciated.

colucix 03-09-2010 03:34 PM

Hi and welcome to LinuxQuestions!

The error message is quite clear. First thought coming in mind is that you're trying to change to a really non-existent directory or you're not typing the directory name correctly. Please, show us what's going on, e.g. go to G95 directory and try the following:
Code:

pwd
to print the full path of the current working directory, and
Code:

ls -F
to see what files and directories are inside it. Copy/paste the result here and tell us exactly which directory you're trying to enter.

jason87x 03-09-2010 04:00 PM

could the fact that linux is case sensitive have to do with it? but yea the error message is straightforward, the file doesnt exist where you need it to be.

bret381 03-09-2010 04:14 PM

so if you are in the G95 directory and you ware wanting to go to folder1 that is inside the G95 directory, how are you moving to that folder?

Code:

cd /folder1
or
Code:

cd folder1
the 2nd should be how you move to the folder from INSIDE G95. But I would definately list all the directories inside G95 before trying to go inside. You may have inadvertantly typed a wrong character that would prevent you from accessing it. So follow above advise and

ls

the directory

itsbrad212 03-09-2010 04:17 PM

It's either the wrong case (L != l) or the directory you are trying to change to really doesn't exist (don't worry, we've all been there). In case you didn't know (I'm guessing you do, but just if you don't), cd means change directory.

itsbrad212 03-09-2010 04:18 PM

It's either the wrong case (L != l) or the directory you are trying to change to really doesn't exist (don't worry, we've all been there). In case you didn't know (I'm guessing you do, but just if you don't), cd means change directory. Make sure the file exists either by browsing for it in a file browser (I have no idea what it is on a mac) or ls (list) in that directory :D

smeezekitty 03-09-2010 04:20 PM

Type ls (as in lowercxse LS) to see what exists.

penguiniator 03-09-2010 05:37 PM

1. The directory does not exist
2. The directory is not named what you think it is
3. You are not in the directory where you think the directory is
or
4. The directory is not where you think it is

pwd will show you where you are
ls will show you what is in the directory you are in
find will help you locate the directory

runinguy 03-10-2010 02:45 AM

I'm pretty sure the directory I want to change to exists, since I created it yesterday using the Mac OS X file browser (it's called Finder). Here it is in Terminal.app:

BenardLenards-MacBook-Pro:~ BenardLenard$ ls
Desktop G95 Movies Public
Documents Library Music Sites
Downloads Misc. Pictures USGSAPPS
BenardLenards-MacBook-Pro:~ BenardLenard$ cd g95
BenardLenards-MacBook-Pro:g95 BenardLenard$ ls
Fortran Code Files INSTALL lib
G95Manual.pdf bin
BenardLenards-MacBook-Pro:g95 BenardLenard$ cd Fortran Code Files
-bash: cd: Fortran: No such file or directory
BenardLenards-MacBook-Pro:g95 BenardLenard$ cd bin
BenardLenards-MacBook-Pro:bin BenardLenard$ ls
i386-apple-darwin8.11.1-g95
BenardLenards-MacBook-Pro:bin BenardLenard$ cd ..
BenardLenards-MacBook-Pro:g95 BenardLenard$ cd lib
BenardLenards-MacBook-Pro:lib BenardLenard$ ls
gcc-lib
BenardLenards-MacBook-Pro:lib BenardLenard$ cd ..
BenardLenards-MacBook-Pro:g95 BenardLenard$ ls
Fortran Code Files INSTALL lib
G95Manual.pdf bin
BenardLenards-MacBook-Pro:g95 BenardLenard$ cd Fortran Code Files
-bash: cd: Fortran: No such file or directory
BenardLenards-MacBook-Pro:g95 BenardLenard$

Here I have navigated into the G95 directory (which does not appear to be case sensitive) and attempted to change directory to the "Fortran Code Files" directory twice without success, while I was successfully able to change directory to the "lib" and "bin" directories within G95.

tredegar 03-10-2010 03:18 AM

Quote:

BenardLenards-MacBook-Pro:g95 BenardLenard$ cd Fortran Code Files
-bash: cd: Fortran: No such file or directory
Spaces in filenames must either be "escaped" with the \ character:

cd Fortran\ Code\ Files

or put in quotes:

cd "Fortran Code Files"

bret381 03-10-2010 07:02 AM

yep, can't have spaces in the browser without being escaped

cd Fortran\ Code\ Files

will do it

an easy way to fix that if you plan on using the terminal a lot is to use _ instead of a space between words, so you would have Fortran_Code_Files

runinguy 03-10-2010 12:59 PM

Thanks for the help everyone.

I was now successfully able to change to the directory (used quotation marks around the multi-word directory name), compile a code file, and then run the output file (I used "./a.out" where "a.out" is the name of the output file). Can anyone tell me what the ./ means or if there are other ways to run executables?

Also, if I remove a file from a directory with the "rm" command, where does it go?

bret381 03-10-2010 01:10 PM

you can move executables to your /usr/bin directory and you won't have to use the ./ in front of it

penguiniator 03-10-2010 02:49 PM

rm deletes a file permanently. It is sent into oblivion.

jamescondron 03-10-2010 02:57 PM

Not quite. Scrub perhaps, but not rm.


All times are GMT -5. The time now is 12:27 PM.