LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-10-2016, 11:03 PM   #1
wildad1
LQ Newbie
 
Registered: Oct 2016
Posts: 2

Rep: Reputation: Disabled
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 #
 
Old 10-10-2016, 11:42 PM   #2
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Try changing directory 'without' the forward slash:-

Code:
cd Downloads
https://community.linuxmint.com/tutorial/view/244
 
Old 10-10-2016, 11:50 PM   #3
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
IF the above doesn't work;;;;;
Use 'reset' to reset your terminal when it gets messed up by control sequences.
 
Old 10-11-2016, 12:39 AM   #4
aragorn2101
Member
 
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 567

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
Quote:
Originally Posted by wildad1 View Post
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.
 
2 members found this post helpful.
Old 10-11-2016, 07:03 AM   #5
wildad1
LQ Newbie
 
Registered: Oct 2016
Posts: 2

Original Poster
Rep: Reputation: Disabled
Got it

Thanks. I got into the directory and got the program installed.
 
1 members found this post helpful.
Old 10-11-2016, 06:00 PM   #6
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 364Reputation: 364Reputation: 364Reputation: 364
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).
 
Old 10-11-2016, 06:18 PM   #7
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by wildad1 View Post
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.
 
Old 10-12-2016, 08:19 AM   #8
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
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 >> $

Last edited by BW-userx; 10-12-2016 at 08:23 AM.
 
Old 10-12-2016, 07:10 PM   #9
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Rep: Reputation: 54
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).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Linux Mint 17.1 review—less change is good change LXer Syndicated Linux News 0 12-09-2014 12:30 PM
Shell Script required to change directories in linux kavan.shah Linux - Newbie 12 05-19-2014 01:52 PM
Why can't I change ownership of files/directories in Debian Linux? bmartisius Linux - Newbie 3 04-05-2013 07:55 AM
Change wi-fi connection on Linux Mint jocko Linux - Newbie 4 05-07-2012 10:12 AM
[SOLVED] Change access settings of directories shared from Linux Server-samba jufo Linux - Server 4 11-18-2011 05:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration