View Full Version : [ubuntu] [SOLVED] How to Change Directories that has spaces in terminal
fr.theo
June 22nd, 2008, 03:26 AM
Hello, Everyone
I was wondering If any one knew how to change a directory that has a space in it eg. "Linux Is The Best" compared to "Linuxisthebest", I know how to change directories with whole names easily but those with spaces I am having difficulty.
any help would be much appreciated.
Kind Regards.
Fr. T
Oldsoldier2003
June 22nd, 2008, 03:29 AM
Hello, Everyone
I was wondering If any one knew how to change a directory that has a space in it eg. "Linux Is The Best" compared to "Linuxisthebest", I know how to change directories with whole names easily but those with spaces I am having difficulty.
any help would be much appreciated.
Kind Regards.
Fr. T
cd Lin [tab]
fahadsadah
June 22nd, 2008, 03:31 AM
This would only work if there was nothing else in the directory beginning with Lin.
It would be more correct to do a cd Linux\ is\ The\ Best
Oldsoldier2003
June 22nd, 2008, 03:31 AM
or you can escape the spaces with \ and end the name with / like so:
cd Linux\ is\ the\ best/
vvvladut
June 22nd, 2008, 03:31 AM
You have to precede the spaces with a backslash symbol: \
Like this:
you@yourdesktop:~$ cd Linux\ Is\ The\ Best
fahadsadah
June 22nd, 2008, 03:33 AM
The forward slashs are unneccesary, and all they do is help to make a picket fence.
Oldsoldier2003
June 22nd, 2008, 03:33 AM
nvm typoed when comparing the commands. Either way works fine. But from a practical stanpoint , use dashes or underscores when naming directories instead of spaces and you'll never have this issue :)
ad_267
June 22nd, 2008, 03:35 AM
You can also use:
cd "Linux Is The Best"
You don't need a / at the end.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.