Linux-Noob Forums
Terminal wants backslash instead of slash for path names... how do I fix this? - Printable Version

+- Linux-Noob Forums (https://www.linux-noob.com/forums)
+-- Forum: Linux Noob (https://www.linux-noob.com/forums/forum-3.html)
+--- Forum: How Do I? (https://www.linux-noob.com/forums/forum-60.html)
+--- Thread: Terminal wants backslash instead of slash for path names... how do I fix this? (/thread-106.html)



Terminal wants backslash instead of slash for path names... how do I fix this? - odougs - 2013-04-15


 Hello everyone!
 
 I'm a new Linux user running Lubuntu 12.04. I have recently encountered some strange behavior when using the terminal (LXTerminal, BASh).
 
 The terminal no longer accepts forward slash ( \ ) for path names. It works fine when I use backslash ( / ), but this annoys me - I don't want to get in the habit of doing it backwards! Oddly enough, it will echo forward slash when I use 'pwd' or use 'cd' with backslash.
 
 

Quote:<div>
 

odougs@ODT61:~$ pwd

<div>/home/odougs
odougs@ODT61:~$ cd /Documents
bash: cd: /Documents: No such file or directory
odougs@ODT61:~$ cd \Documents
odougs@ODT61:~/Documents$ 
</div>
 

</div>
 
 
 I don't know what caused this, or exactly when it started. I haven't really been messing with the shell config files; the only changes I have made in that regard are to append JAVA_HOME and PATH assignments to the '.profile' configuration file... and the problem is still there when I restore my backup copy of '.profile' and reboot.
 
 So, I am quite lost, but also very curious about this. Where might this behavior originate from, and what can I do to change it back?
 
 Thanks very much!



Terminal wants backslash instead of slash for path names... how do I fix this? - inittux - 2013-04-15


To start out with to cd to a path location you always use foward slash, a default  .profile copy is located in /etc/skel/.bash_profile you can copy this file if you have made changing to the .bash_profile in your own home directory.

 

The thing you are doing wrong is: you are putting a / in front of documents. You are already in the same folder as the folder name so all you have to do is: cd Documents. The linux has the following hierarchy structure.

 

ls /
bin  boot  cgroup  dev  etc  home  lib  lib64  lost+found  media  misc  mnt  net  opt  proc  root  sbin  selinux  srv  sys  tmp  usr  var

 

so everything starts at root(/) When you tried /Documents it couldn't find the location because you were telling it to go to  the directory "Documents" under the root directory of the file system. While in reality you were already in /home/odougs and the Documents directory being in that location. So all you have to do is cd  Documents, you can also just type cd  Doc and then press tab to auto complete the directory name and you should be able to ender the directory. You have two ways of cding to a location: absolute path and relative.

 

Absolute path aka full path(starting in root /)= cd /home/odougs/Documents

Relative path(starting from the current dir you are inpwd = /home/odougs/Documents Where we want to go for example Pictures.  cd ../Pictures

 

.. = going to the parent diretory

 

just cd gets you s back to your home dir

 

Hope that helps you on your way?


 




Terminal wants backslash instead of slash for path names... how do I fix this? - odougs - 2013-04-15

 Ahh, thanks, that makes a lot of sense! Maybe next time I'll read more about the basics before I complain that something is broken... [img]<___base_url___>//public/style_emoticons/default/laugh.png[/img]



Terminal wants backslash instead of slash for path names... how do I fix this? - inittux - 2013-04-16

Glad it helped you out! You learn more as you work more with linux :)