Jump to content
odougs

Terminal wants backslash instead of slash for path names... how do I fix this?

Recommended Posts

 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.
 
 

 

odougs@ODT61:~$ pwd

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

 

 
 
 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!
  • Like 3

Share this post


Link to post
Share on other sites

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?


 

Share this post


Link to post
Share on other sites

 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... laugh.png

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...