PDA

View Full Version : [SOLVED] 10.10: bash cd: confused by error message



XEtedBear
December 21st, 2010, 11:56 AM
I'm trying to change to a subdirectory:


tony@advent:~/scratch$ cd Home-Arch
bash: cd: Home-Arch: No such file or directory


So I list the contents of the current directory:



tony@advent:~/scratch$ ls
duhome Home-Arch qcad_1.dxf qcad_1.svg runme stdout


Huh?

OK, I assume I have mis-typed the subdirectory name in ways I cannot detect, so I copy the sub-directory name from the output of the 'ls' command, while within the terminal window, and paste it into the next 'cd' command:



tony@advent:~/scratch$ cd Home-Arch
bash: cd: Home-Arch: No such file or directory


Double Huh?

I browse the directory and sub-directory in Nautlius - everything is there where I expect it to be. The folders/files are not hidden.

What is happening here?

karthick87
December 21st, 2010, 12:00 PM
Try,

cd "Home-Arch"

mcduck
December 21st, 2010, 12:10 PM
..and if that doesn't work, what does "ls -l" say?

XEtedBear
December 21st, 2010, 12:41 PM
Try,

cd "Home-Arch"



tony@advent:~/scratch$ cd "Home-Arch"
bash: cd: Home-Arch: No such file or directory

XEtedBear
December 21st, 2010, 12:46 PM
..and if that doesn't work, what does "ls -l" say?



tony@advent:~/scratch$ ls -l
total 280
-rw-r--r-- 1 tony tony 103200 2010-12-05 10:04 duhome
drwxr-xr-x 3 tony tony 4096 2010-12-21 11:43 Home-Arch
-rw-r--r-- 1 tony tony 11535 2010-12-20 16:35 qcad_1.dxf
-rw-r--r-- 1 tony tony 111324 2010-12-20 16:36 qcad_1.svg
-rw-r--r-- 1 tony tony 23 2010-12-05 09:38 runme
-rw-r--r-- 1 tony tony 0 2010-12-05 09:40 stdout
tony@advent:~/scratch$


So, is it the permissions on this folder that are the cause of the error message? I checked them while in Nautilus and it seemed to me that my userid has all the permissions I would require to cd into the folder.

mcduck
December 21st, 2010, 02:14 PM
That's strange. Rwad & execute permissions are definitely enough toa ccess a directory.

What happens if you try to access it using the full path:

cd /home/tony/scratch/Home-Arch

..also, just to be sure the directory name doesn't have a space in the end or something like that, try using the Tab autocompletion to fill in the name. (type "cd Ho" and press tab to fill the rest, for example)

XEtedBear
December 21st, 2010, 03:12 PM
That's strange. Rwad & execute permissions are definitely enough toa ccess a directory.

What happens if you try to access it using the full path:

cd /home/tony/scratch/Home-Arch

..also, just to be sure the directory name doesn't have a space in the end or something like that, try using the Tab autocompletion to fill in the name. (type "cd Ho" and press tab to fill the rest, for example)

This is most intriguing:

tony@advent:~$ pwd
/home/tony
tony@advent:~$ cd /home/tony/scratch/Home-Arch
bash: cd: /home/tony/scratch/Home-Arch: No such file or directory


So now I follow your most insightful advice and use the Tab technique (which is completely new to me). I tabbed after 'Ho' after '/scratch/' with this result:

tony@advent:~/scratch/Home-Arch $ cd /home/tony/scratch/Home-Arch\ /
tony@advent:~/scratch/Home-Arch $


So where did these extra back and forward slashes come from - and how do I delete them?

XEtedBear
December 21st, 2010, 05:09 PM
Actually, I guess it's not important where those extra '/' and '\' came from - I could delete them by rnaming the file in Nautilus. That's solved my problem.

Thaks for the insight into using auto-completion.

mcduck
December 21st, 2010, 05:47 PM
The backslash proves that I guessed correct, and there was a space at the end of the file name. (backslash is used to escape special characters, like spaces.)

For example if you need to access a file that has a space in it's name, you have two ways of typing in the file name so that the sytem still recognizes it as one filename and not two separate files:

"some file"
some\ file

So the backslash tells the shell that the following character should be considered as plain text, without any special meanings it would otherwise have. (a space would normally separate commands, options and different fle names from each other)

(the forward slash it there simply because it's a directory)

akss
July 16th, 2012, 08:34 PM
its mainly because of some spaces in the file name which a Linux kernel can't understand
..
cd /home/personal/naveen data/naveen
i got this error
bash: /home/personal/: no such directory or file
i just renamed my filder name as naveen...n it all worked

mainly space can be neglected by using '/' and then '\'.
like cd naveen\ data/naveen
......

Elfy
July 16th, 2012, 08:49 PM
Old thread closed.