0

I used to use this command cd /Foldername to navigate the folder. But I am facing a problem with this now I need to use this command cd ~/foldername for navigating. Please have a look on the screen capture:
click here to view the image

The fact is how can I retrieve the old command? I prefer the old command.

pomsky
  • 68,507

2 Answers2

2

When you navigate through directories, if you start with / the command cd interprets that it's an absolute path:

$ cd /directory

means (root)/directory, not /home/user/directory.

~ is an alias for /home/user

If you are in your home directory, and type $ cd directory (note there is no /), cd interprets as a relative directory, meaning reltive to your current directory.

1

There is a difference between the two commands.

cd /foldername changes your current working directory to foldername which lies directly under the root.

cd ~/foldername changes your current working directory to foldername, which lies under your home directory, which in most Linux distributions should be under /home/<your-username>/foldername.

Your error message tells you that currently there is no foldername under your root directory.

UrmLmn
  • 121