I type in for example: cp /media/Macintosh
I'm recovering someone's HD so I want to get
Then Tab so that it can correctly put in the formatting for Macintosh HD
I then want it to complete among a few options if you press tab…
for this example there is Desktop and Desktop (old) how do I choose Desktop (old) when I type De
tab tab it shows up there as a list of options but then I don't know how to choose the second option on the list.
I need the correct formatting for the directory "/Desktop (old)/"
and I can use tab to have it do that but I don't know how.
Now I have a new Problem:
I am doing a data recovery for someone:
-Ubuntu:~# cp /media/Macintosh\ HD/Users/orlando/Desktop\ \(original\)/VIDEOS\ ESPANOL/ /media/\$G\$\ DATA/Orlando/Desktop/
cp: omitting directory `/media/Macintosh HD/Users/orlando/Desktop (original)/VIDEOS ESPANOL/'
When I typed that this was my response:
-Ubuntu:~# cp /media/Macintosh\ HD/Users/orlando/Desktop\ \(original\)/VIDEOS\ ESPANOL/ /media/\$G\$\ DATA/Orlando/Desktop/
cp: omitting directory `/media/Macintosh HD/Users/orlando/Desktop (original)/VIDEOS ESPANOL/'
By the way I am logged in as root. What does this mean and how do I fix it?
Now that I know something and this question is popular:
Anybody know a way to modify your bash_profile
so that you can use tab several times to cycle between different paths?
The correct answer for someone actually doing this would be to:
cd ~/.bash_profile
or ~/.basher
open the file with Sublime/TextEditorOfChoice/VIM/echo into the file:
Then copy and paste:
bind '"\t":menu-complete'
OR: bind TAB:menu-complete
Then close and open your terminal/bash/commandprompt.
Best Answer
You don't "choose", you just keep typing. The Tab completion will stop as soon as it finds the 1st character that is different in the two files. So, using your example, you'd see
You just need to keep typing. However, you have chosen to use strange names that contain spaces and parentheses. This is a bad idea since it makes them harder to deal with. To enter a space as part of the file name (it is normally taken to signify the end of a word or file name) you need to escape it with a backslash (
\
). So, in this case, you'd need to write\
(that's \Space) and then hit Tab again:It will magically complete to
Note how the parentheses will be automatically escaped as well.
The above is how Ubuntu's default shell (
bash
) works. Other shells let you hit Tab again to cycle through the available options. For example, bothzsh
andfish
let you cycle through and choose the one you want. Both are in the repositories so you might want to check them out.