LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Can't change directories in Linux Mint (https://www.linuxquestions.org/questions/linux-software-2/cant-change-directories-in-linux-mint-4175591168/)

wildad1 10-10-2016 11:03 PM

Can't change directories in Linux Mint
 
I want to do a simple CD and this is what I get. I can't change into any directory, which should be straightforward.
alan@alan-Inspiron-5537 ~ $ pwd
/home/alan
alan@alan-Inspiron-5537 ~ $ ls
Desktop Documents Downloads Music Pictures Public Templates Videos
alan@alan-Inspiron-5537 ~ $ su root
Password:
alan-Inspiron-5537 alan # pwd
/home/alan
alan-Inspiron-5537 alan # ls
Desktop Documents Downloads Music Pictures Public Templates Videos
alan-Inspiron-5537 alan # cd /Downloads
bash: cd: /Downloads: No such file or directory
alan-Inspiron-5537 alan # cd /music
bash: cd: /music: No such file or directory
alan-Inspiron-5537 alan # cd /Music
bash: cd: /Music: No such file or directory
alan-Inspiron-5537 alan #

Ztcoracat 10-10-2016 11:42 PM

Try changing directory 'without' the forward slash:-

Code:

cd Downloads
https://community.linuxmint.com/tutorial/view/244

Ztcoracat 10-10-2016 11:50 PM

IF the above doesn't work;;;;;
Use 'reset' to reset your terminal when it gets messed up by control sequences.

aragorn2101 10-11-2016 12:39 AM

Quote:

Originally Posted by wildad1 (Post 5616353)
alan-Inspiron-5537 alan # cd /Downloads
bash: cd: /Downloads: No such file or directory
alan-Inspiron-5537 alan # cd /music
bash: cd: /music: No such file or directory
alan-Inspiron-5537 alan # cd /Music
bash: cd: /Music: No such file or directory
alan-Inspiron-5537 alan #

Hi,

The pwd command gives you your Present Working Directory. As you saw, it was /home/alan.

Now you should understand the Linux filesystem standard a little bit. The root of the filesystem is /. "/" actually is a directory. And if you do
Code:

cd /
you get into the directory /. If you do ls in the directory / you will see the content of your root filesystem.

When you are doing
Code:

cd /Downloads
Bash is understanding that you are seeking the directory Downloads under directory /. And if you tried the above ls command, you will understand that there is no Downloads or Music under directory /.

The directories you are looking for are under /home/alan. So, you should either be in /home/alan and do
Code:

cd Downloads
or from anywhere else you can do
Code:

cd /home/alan/Downloads
OR
cd ~/Downloads

The "~" means "my home directory". It is contained in the variable HOME, which you can check with
Code:

echo $HOME
If you are user alan, it should give you /home/alan. If you are user root, it will give you /root.

wildad1 10-11-2016 07:03 AM

Got it
 
Thanks. I got into the directory and got the program installed.

Jjanel 10-11-2016 06:00 PM

Welcome! It's easy for a new-user to fall into something like this.

The 'trick' is to 'craft' a sufficiently-precise web-search.
Someone here! fell into SAME...

Best wishes! ENJOY your Linux journey! (A ton of links here )

p.s. don't forget to mark this Thread as "Solved" (Thread Tools, at top).

Ztcoracat 10-11-2016 06:18 PM

Quote:

Originally Posted by wildad1 (Post 5616429)
Thanks. I got into the directory and got the program installed.

Your Welcome:-

Glad it worked for you. Don't forget to mark your thread SOLVED.

BW-userx 10-12-2016 08:19 AM

if your in the base dir to me meaning that if you ls and get the reading such as this.

Code:

userx@Voided.1 & ~ >> $ls
Desktop        Music    Templates    freebsd       
Documents        Pictures  Videos       
Downloads    Public    blender-temp  testdisk.log

your current directories are already there to do not add the /
Code:

userx@Voided.1 & ~ >> $cd Documents
userx@Voided.1 & Documents >> $pwd
/home/userx/Documents

if you are in root login from a user then issue a cd that will take you into the root home dir, opps maybe that is not where you wanted to be. now you have to do absolute path to get back to that users environment.

Code:

userx@Voided.1 & Documents >> $su
Password:
sh-4.3# pwd
/home/userx/Documents

sh-4.3# cd
sh-4.3# pwd
/root

sh-4.3# cd /home/userx/Documents
sh-4.3# pwd
/home/userx/Documents
sh-4.3#

if you just want to get back to the users environment in a hurry then do this
Code:

sh-4.3# cd
sh-4.3# pwd
/root
sh-4.3# exit
exit
userx@Voided.1 & Documents >> $


Red Squirrel 10-12-2016 07:10 PM

When you start a path with the forward slash it implies it is a full path and not relative, so it was actually looking for a folder right in / called Downloads. What you probably wanted to do is ../ which means "go back one folder" So say you are in Documents and Downloads is in the same folder as Documents, you would do cd ../Downloads to move to that folder in one command. Alternatively you can do cd .. to go back one folder then cd to Downloads (no slashes).


All times are GMT -5. The time now is 03:41 AM.