Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm completely new and lost in Ubuntu 12.04, I'm having trouble navigating to my Sublime folder which I know is in my /opt folder. Yet I've tried to no avail to navigate into it via Terminal window. The directory is colored in blue, no idea what this means...but I am able to access the folder using the GUI explorer...?

k@k-Ubuntu:~$ cd /opt
k@k-Ubuntu:/opt$ ls
Sublime Text 2
k@k-Ubuntu:/opt$ cd Sublime Text 2
bash: cd: Sublime: No such file or directory
k@k-Ubuntu:/opt$ cd /Sublime Text 2
bash: cd: /Sublime: No such file or directory
share|improve this question
    
the default color scheme colours directories blue. –  djeikyb Jan 1 at 5:27

1 Answer 1

up vote 3 down vote accepted

Go inside the /opt directory via terminal and then run below command,

k@k-Ubuntu:~$ cd /opt
k@k-Ubuntu:/opt$ cd "Sublime Text 2"

As the folder you want to connect has spaces in the name, you must surround the name with quotes in order for the Shell to read it correctly (as one name). In other case it will read only the Sublime and this doesn’t exist.

Another way to avoid this issue, is to use Tab Completion. This is a feature that will help you to auto-fill weird names and/or long names. Read here about Tab Completion and learn it. It is very useful(in Ubuntu is pre-installed).

A third way for names with spaces is the backslash \ . Above command with quotes could be

cd Sublime\ Text\ 2/

the backslash works like a space.

A suggestion could be: Do not create folders in Linux with space in name. Prefer something like Sublime-Text-2 or Sublime_Text_2

share|improve this answer
1  
or after going to /opt, type cd Sub and then press Tab to autocomplete. –  Web-E Jan 1 at 4:50
    
Can you please explain to me why you need to use the double quotes? Is this for all directories that have spaces? Or for the directories marked in blue in the Terminal window? –  Kansas City Shuffle Jan 1 at 4:50
    
no,its for the directory which contains spaces on their names. –  Avinash Raj Jan 1 at 4:51
    
Tried the tab for autocomplete, didn't do anything? - NVM, my mistake didn't use the caps on S. :/ –  Kansas City Shuffle Jan 1 at 4:51
    
Thanks for all the help and information guys, appreciate it! –  Kansas City Shuffle Jan 1 at 4:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.