LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   "cd \" ? (https://www.linuxquestions.org/questions/linux-newbie-8/cd-%5C-230759/)

blackzone 09-15-2004 12:05 AM

"cd \" ?
 
I sometime mistakenly type "cd \" to enter root directory

should be "cd /" opsite of window "cmd"

And a promp ">" comes out. What is it for?

PenguinPwrdBox 09-15-2004 12:17 AM

When you enter a command, without parameters, it will (depending on the command) allow you to enter those parameters after entering the command. So, for instance, type "cd" and press enter. You'll get >
Then, type a directory. and press enter. It will show you the contents of that directory the same as cd <dir> would.

It will then allow you to enter as many as you like.

To quit, press CTRL+C

realjustin 09-15-2004 12:17 AM

If you do / and hit enter, it continues the command on the next line is all.

pippet 09-15-2004 01:17 AM

if u enter cd on commandline, it will change ur current directory to ur home directory.

theYinYeti 09-15-2004 01:52 AM

Quote:

Originally posted by PenguinPwrdBox When you enter a command, without parameters, it will (depending on the command) allow you to enter those parameters after[...]
Not quite that. Actually, "cd" without parameters is perfectly valid: it will go to the home-directory.

What's happening here is that \ is used by bash (the shell) to "escape" characters, which means taking from those characters their special meaning, so that they become normal characters.

For bash:
- $ is for introducing a variable, such as $HOME. \$ is simply a "dollar" sign.
- * is for expanding to any number of characters, matched against files in current directory. \* is simply a "star" sign.
- ? is for expanding to one single character, matched against files in current directory. \? is simply a question mark.
- ... and so on...
- And carriage-return is for ending the current command-line. \<CR> is simply a carriage-return character, that is a "blank" (or separator) from the shell's point of view. It just means that you're not done with editing the current command-line.

Yves.

AnanthaP 09-15-2004 04:55 AM

To further clarify, pressing \ + <return> makes the shell "escape" thus taking the <return> as a character argument to `cd` and waiting for a <return> to complete the argument list (to cd).

Since it escapes to <return>, the shell assumes that you have finished one line and so displays PS2 (which is Prompt string 2 and is usually set to ">").

So it waiting for command completion.

Simply give a <return> and ignore the error (may be something like "^M doesnt exist" ...

HTH.
End

AnanthaP 09-15-2004 04:59 AM

Also, windoze command "cmd" is an updated version of COMMAND.com which usually lands up in c:\windows\system or some other dangerous folder whereas `cd` (cd without arguments) in Unixes mean change to your home directory.

End

PenguinPwrdBox 09-15-2004 06:25 AM

For some reason - I thought we were talking about ls.....

What can I say - it was like 2am when I posted :p


All times are GMT -5. The time now is 06:29 AM.