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. |
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 Code:
ls -F |
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.
|
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 Code:
cd folder1 ls the directory |
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.
|
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
|
Type ls (as in lowercxse LS) to see what exists.
|
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 |
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. |
Quote:
cd Fortran\ Code\ Files or put in quotes: cd "Fortran Code Files" |
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 |
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? |
you can move executables to your /usr/bin directory and you won't have to use the ./ in front of it
|
rm deletes a file permanently. It is sent into oblivion.
|
Not quite. Scrub perhaps, but not rm.
|
All times are GMT -5. The time now is 12:27 PM. |