Newbie using terminal

Joined
Feb 14, 2008
Messages
15
Reaction score
0
Points
1
In Tiger I'm using Pico in Terminal to write html pages.
I don't know how to change to directories that have spaces, quotes or underscores in their names.
When I type the full name, or the first 6 characters followed by ~1, Terminal just goes to a new line consisting of > and does not respond to any commands.
Can I move into my long directory name_files or open a file within it? or do i have to rename everything to a name that Terminal can cope with?
Advice would be gratefully received.
Frank
 
Joined
Feb 14, 2004
Messages
4,781
Reaction score
166
Points
63
Location
Groves, Texas
To cd to a folder with a space in it you need to "escape" the name. For instance:
cd ~/folder/'folder with space'
You can also use a " as an escape.
Naming folders with quotes is NOT recommended.
Folder names with underscores should work correctly as is.
 
Joined
Dec 31, 2007
Messages
5
Reaction score
0
Points
1
Remember that you can use the \ as the escape. For example you have a file called:

/Users/Frank Sinatra/my songs/"Eye" by Smashing Pumpkins, the.mp3

You can use it in terminal as:

/Users/Frank\ Sinatra/my\ songs/\"Eye\"\ by\ Smashing\ Pumpkins\,\ the.mp3

or

'/Users/Frank Sinatra/my songs/"Eye" by Smashing Pumpkins, the.mp3'
 
OP
F
Joined
Feb 14, 2008
Messages
15
Reaction score
0
Points
1
Thank you very much.
Both work.
I've also discovered the use of the wild card * gives every file that starts with the typed characters. Good shorthand for where there are few files or folders to choose from. Sticking the * in the middle of the path allows you to define the starting and ending characters of the files or folders you want to select.
Frank
 
Joined
Mar 17, 2008
Messages
6,879
Reaction score
191
Points
63
Location
Tucson, AZ
Your Mac's Specs
Way... way too many specs to list.
Keep in mind you don't actually have to type all that either. OS X, like many other *nix OS's has tab completion. So for example in the above commands I'd type

/Us (hit tab, so it'll now say)
/Users/ (then type) Frank (hit tab)
/Users/Frank\ Sinatra/my (tab)

etc it will continue to build the command structure for you. I hope that made some sense, if not... try hitting the tab key while you're typing out your file path and see what happens.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top