root directory
i am using fedora 13.
if is use the command "cd //". it changes to root directory.how is it? what "//" denote? thanks in advance.. |
Well this is strange. I did not try that command but then I think that should not work. You should try cd /.
For more info about directories try man hier. Hope this helps. |
The backslash is used in the shell as an escape character. Since some characters, such as spaces, have special meanings, putting a backslash (also a special character) in front of them protects them from interpretation by the shell and makes them literal again. "/ " is a literal space, "/[/]" are literal brackets, and "//" is a literal forward slash.
So in the shell, // = /. But then it's up to the command you're passing it to how to interpret the single literal backslash. The cd command can accept one as a directory separator. You could also use cd "/" or cd '/', which do the same thing. |
I’ve used cd / and cd.. , but never cd //.
cd / puts you in the top directory, wherever you are. If enter an ls after cd / you should see some of these top-level directories: boot bin dev etc home lib misc mnt net opt root srv usr var cd .. puts you one directory ABOVE wherever you are. More info. on the cd command is available here. Info. on directory on Fedora directories is available here. |
Hi,
Quote:
Quote:
Quote:
'man command' is your friend! :hattip: |
This is intentional action. All consecutive slashes are replaced with one slash to canonicalization. I think this was made for simplify writing scripts.
|
Also, trailing slashes in a path only denote that the path is, in fact, a directory (as opposed to another file type). Try "cd /home" and "cd /home/". Same result (you end up in /home). "/" is the name of a directory (the root directory). Therefore, putting a slash after it is just like (redundantly) saying that "/" is, in fact, a directory.
If you're trying to get to a networked path, you'll want to use the distributions SMB/Samba network browser. There, you can enter a path like "//computer/sharedirectory/file", and it will take you to the expected location. You can also do this using smbmount or "mount -t cifs" like this: Code:
mount -t cifs //computer/sharedirectory/ /place/you/want/to/mount/it/ Code:
mount -t cifs \\\\computer\\sharedirectory\\ /place/you/want/to/mount/it/ --Dane NOTE: The character mentioned in your original post, "/", is NOT a backslash. It is a forward slash (the one on the "?" key, on a QWERTY keyboard). A forward slash, "/", is used in Linux to denote directories, and is not an escape character, although it does have special meaning (namely to denote directories), and thus can BE escaped using a backslash, "\". You do not have to put more than one forward slash to denote a directory or sub-directory. Thus, the following is how to denote a directory/sub-directory: Code:
cd /home/me/stuff/morestuff/ A backslash, "\", on the other hand, IS an escape character, and also has special meaning (which means that it can be escaped by another backslash). The backslash is on the same key as the pipe, "|", and is usually next to or under the BACKSPACE key. In the examples above, corrected, "\ " is a literal space, "\[\]" are literal brackets, and "\\" is a literal backslash. A literal forward slash is written, simply, "/". (Examples taken from post #3 by David the H.) |
All times are GMT -5. The time now is 06:25 PM. |