I’ve been trying to reduce the size of the Time Machine backup on my Time Capsule with a nifty trick that I’ll share in the next post. In the process I learned something very useful in dealing with Terminal commands, in particular with directories.
The name of the directory I was trying to ‘cd’ into had spaces as seen below. I used the “ls” command to show a list of drives in /Volumes.
If I simply type “cd /Andrew Cockerham’s Time Cap” it will give an error “no such file or directory”. So to get into that directory, the easiest way is to wrap it in quotes:
You can ignore the fact that I’m in ‘root’ to do this method, you do not need to be in root for it to work.
The second way to do it is using backwards slashes, ‘\’, before each space in the directory name:
Note also that back slashes must be in front of the special characters, in this case the apostrophe.
Now this leads me to the next trick. Typing out this long directory name with all the back slashes can be tedious, so a great shortcut is to simple start typing the first few letters of the directory, and then pressing the “Tab” key, and it will autocomplete the directory name for you, automatically adding the back slashes where need.
I love neat little keyboard shortcuts, especially in Terminal.
Hope you found it useful!