LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-13-2016, 02:33 PM   #1
buzzkill.hardball.667
LQ Newbie
 
Registered: Sep 2016
Posts: 2

Rep: Reputation: Disabled
Question Directory problem, probably very easy


ok so all i want to do is move my music directory (which is almost 3000 songs) to another partitition in which to gain some space in the directory and i have this problem for starters..


root@Buzzkill:~/Music# ls
Downloaded ftom G.P.
root@Buzzkill:~/Music# cd Downloaded from G.P.
bash: cd: Downloaded: No such file or directory
root@Buzzkill:~/Music#


Ugh can someone please help me here??????
 
Old 09-13-2016, 02:35 PM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,804

Rep: Reputation: 944Reputation: 944Reputation: 944Reputation: 944Reputation: 944Reputation: 944Reputation: 944Reputation: 944
use quotes with spaces in directory name
Code:
cd "Downloaded ftom G.P."
(is it ftom or from?)
 
Old 09-13-2016, 02:36 PM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
first of all, don't be root.
just don't.

then:
Code:
cd "Downloaded from G.P."
edit:
ninja'd by keefaz!
but i ninja'd isaackuo!

Last edited by ondoho; 09-13-2016 at 02:38 PM.
 
Old 09-13-2016, 02:37 PM   #4
IsaacKuo
Senior Member
 
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
Blog Entries: 8

Rep: Reputation: 465Reputation: 465Reputation: 465Reputation: 465Reputation: 465
It is confused because of the spaces in the directory name. Try enclosing the name in double quotes like this:

Code:
cd "Downloaded from G.P."
Or simply type in "cd Down" and then hit "tab" to auto-complete the file name. You will see it put backslashes before the spaces to escape them out.
 
1 members found this post helpful.
Old 09-13-2016, 02:40 PM   #5
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,675

Rep: Reputation: Disabled
Bash completion can do it for you ...
 
Old 09-15-2016, 03:58 AM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.x
Posts: 18,442

Rep: Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791Reputation: 2791
Just a general comment to OP: even though a <space> char is syntactically legal in file/dir names in *nix, the convention is NOT to use them...
This is because the cli convention for programs/tools/cmds is that <space> chars separate successive args/params to a program. As you have discovered, this causes problems if you didn't mean that.

FWIW, I've been using *nix for many years and I've never seen a file/dirname with spaces in it provided by a *nix OS or tool supplier - its a well-known gotcha.

HTH & welcome to LQ
 
Old 09-16-2016, 01:15 AM   #7
aragorn2101
Member
 
Registered: Dec 2012
Location: Mauritius
Distribution: Slackware
Posts: 567

Rep: Reputation: 301Reputation: 301Reputation: 301Reputation: 301
Quote:
Originally Posted by buzzkill.hardball.667 View Post
root@Buzzkill:~/Music# ls
Downloaded ftom G.P.
root@Buzzkill:~/Music# cd Downloaded from G.P.
bash: cd: Downloaded: No such file or directory
root@Buzzkill:~/Music#
Hi,

First of all there are certain characters in Bash which are used by the shell for control so you basically need to escape these characters when you want to use their literal meaning.

For example, the good old whitespace character " ". Whitespaces usually separate arguments on the command line. This is why, by the way, that it is not good practice to use whitespaces in dir/file names because they might cause problems in scripts.

So, the command
Code:
cd Downloaded from G.P.
basically tells Bash that you want to change to directory "Downloaded" and, "from" and "G.P." are just additional arguments.

Therefore, if you want to include the whitespaces in the file name, you should escape the whitespaces like this:
Code:
cd Downloaded\ from\ G.P.
Or you can also use quotes which tell Bash that everything between the quotes is a single parameter.
 
1 members found this post helpful.
Old 10-29-2016, 03:04 AM   #8
buzzkill.hardball.667
LQ Newbie
 
Registered: Sep 2016
Posts: 2

Original Poster
Rep: Reputation: Disabled
Cool Thank you for all your help but....

Well since my last post I have completely lost my music file which I downloaded from my Google account. I have all my music backed up to Google because of this very reason. My comp crashed and I lost everything but hey I still have my Sanity. I completely forgot I even posted on this site because it took me a long time to recover from the crash. But I'm back now and now I'm working on another project that maybe all of you can help me with. I want to build my own OS out of all my favorite features of the OS's I have used in the past. I may be a new user compared to most of you but I love everything about linux and now I really would love to give this a shit. I know this may take time but I m a very dedicated person when I put my mind to a project. I need all the help I can get. Thank you
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Separate root directory = easy re-install? psuliin Linux - Newbie 6 01-20-2011 05:16 AM
LXer: Quick and easy sharing of a directory over HTTP in Linux LXer Syndicated Linux News 0 01-14-2009 01:30 AM
LXer: Directory services made easy with Fedora Directory Server LXer Syndicated Linux News 0 12-08-2006 03:54 AM
Easy Question, can I place any directory onto another server? lexington Linux - Newbie 4 05-26-2004 01:38 PM
Redhat 7.3 ftp directory tree. Easy one GrayLOK Linux - General 3 08-31-2002 05:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06: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