Terminal Question Time

StarBuck

Registered
I have two quick questions

1 how do i change directory if the directory has spaces in the name?
EXAMPLE microsoft office x.

2 I have partitioned my hard drive into three how do i switch between them in the terminal.

Thanks
 
1. use "\ " to insert a space so, "cd Microsoft\ Office\ X"

2. There is a thread in the Mac OS X Hints and Tips forums about this...
 
when i want to change directories in terminal i sometimes find it easier to drag and drop the directory i want to be in , onto the terminal window.
for example if i want change to the second partion on my mac ,
i open the terminal ,
type cd
then drag the disk icon onto the treminal window
then press return
how it helps
 
There's an even easier way. It's called "auto-completion", and it's really handy.

Let's say you're in the folder /Applications and you want to get into the directory called "Microsoft Office X". You could type the whole thing out with the backslashes if you wanted, or you could use gigi's drag-and-drop method. However, it's probably easier if you do this: type the command and then start typing the directory you want to change to (for example, type cd Micros). Now press the tab key. If there's only one folder that starts with the string "Micros", the Terminal will automatically fill in the rest for you, giving you the command cd Microsoft\ Office\ X. Then you can press return and execute the command. If there are two or more folders that start with that string, it'll beep and give you a listing of all those folders that start with that string and then retype what you've already typed. So let's say you have two directories called "Microsoft Office X" and "Microsoft Internet Explorer". If you typed cd Micros and pressed tab, the Terminal would beep, list both Microsoft\ Office\ X and Microsoft\ Internet\ Explorer, and then give you another prompt with cd Micros already typed.

As you can see, this comes in handy very often.

As for your question about partitions, here's your answer. Your partition that OS X is installed on is always going to be the root directory, or simply /. All other partitions are stored in the /Volumes folder. So if lets say the partition you've installed OS X on is called "OSXDisk" and a second partition is called "OtherDisk", then to switch to the "OtherDisk" partition, you would simply type cd /Volumes/OtherDisk and press return. To get back to your main partition that has OS X installed on it, you would simply do cd /.

I hope this helps.
 
OS X has tcsh set up to do command auto compleation as well. Which significantly adds to the power of AC.

Look for the file /usr/share/init/tcsh/completions and take a look at the contents.

Here is an example. type ssh -c <Tab> and it should give you a listing of the posible cyphers for ssh.
 
Back
Top