LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-09-2010, 03:20 PM   #1
runinguy
LQ Newbie
 
Registered: Mar 2010
Location: CA
Posts: 9

Rep: Reputation: 0
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.
 
Old 03-09-2010, 03:34 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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.
 
Old 03-09-2010, 04:00 PM   #3
jason87x
LQ Newbie
 
Registered: Jun 2009
Posts: 10

Rep: Reputation: 0
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.
 
Old 03-09-2010, 04:14 PM   #4
bret381
Member
 
Registered: Nov 2009
Location: Alabama
Distribution: Arch x86_64
Posts: 650

Rep: Reputation: 79
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
 
Old 03-09-2010, 04:17 PM   #5
itsbrad212
Member
 
Registered: Nov 2009
Location: Chicago
Distribution: Arch and OpenBSD
Posts: 104

Rep: Reputation: 19
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.
 
Old 03-09-2010, 04:18 PM   #6
itsbrad212
Member
 
Registered: Nov 2009
Location: Chicago
Distribution: Arch and OpenBSD
Posts: 104

Rep: Reputation: 19
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
 
Old 03-09-2010, 04:20 PM   #7
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
Type ls (as in lowercxse LS) to see what exists.
 
Old 03-09-2010, 05:37 PM   #8
penguiniator
Member
 
Registered: Feb 2004
Location: Olympia, WA
Distribution: SolydK
Posts: 442
Blog Entries: 3

Rep: Reputation: 60
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
 
Old 03-10-2010, 02:45 AM   #9
runinguy
LQ Newbie
 
Registered: Mar 2010
Location: CA
Posts: 9

Original Poster
Rep: Reputation: 0
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.
 
Old 03-10-2010, 03:18 AM   #10
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
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"

Last edited by tredegar; 03-10-2010 at 03:19 AM. Reason: \ !
 
Old 03-10-2010, 07:02 AM   #11
bret381
Member
 
Registered: Nov 2009
Location: Alabama
Distribution: Arch x86_64
Posts: 650

Rep: Reputation: 79
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

Last edited by bret381; 03-10-2010 at 07:03 AM.
 
Old 03-10-2010, 12:59 PM   #12
runinguy
LQ Newbie
 
Registered: Mar 2010
Location: CA
Posts: 9

Original Poster
Rep: Reputation: 0
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?
 
Old 03-10-2010, 01:10 PM   #13
bret381
Member
 
Registered: Nov 2009
Location: Alabama
Distribution: Arch x86_64
Posts: 650

Rep: Reputation: 79
you can move executables to your /usr/bin directory and you won't have to use the ./ in front of it
 
Old 03-10-2010, 02:49 PM   #14
penguiniator
Member
 
Registered: Feb 2004
Location: Olympia, WA
Distribution: SolydK
Posts: 442
Blog Entries: 3

Rep: Reputation: 60
rm deletes a file permanently. It is sent into oblivion.
 
Old 03-10-2010, 02:57 PM   #15
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 70
Not quite. Scrub perhaps, but not rm.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
VLC + sudo = "cannot find any file in directory" error skubik Linux - General 3 11-30-2009 01:52 PM
Error: "libdmx.so.1: cannot open shared object file: No such file or directory" ESC201 Linux - Software 4 11-01-2008 08:38 PM
Format command shows "Cannot get current directory - I/O error" devn Solaris / OpenSolaris 1 06-18-2008 01:26 AM
Error in man command "sh: line 1: /usr/bin/gtbl: No such file or directory" MinA Slackware 1 09-06-2004 06:36 PM
error while trying to install program: "X11/Xlib.h: No such file or directory" nate1 Linux - Newbie 3 05-21-2004 08:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration