Terminal

Glenmac

Registered
I am brand new to Terminal and trying to learn it. I have read OS manual and learning slowly but have 2 questions:
1) When I open my Terminal app, instead of stating my computer name, it has a number: __-___-___-___:, then ~user$. Why is there a number instead of a name?

2) When do you use a space in your commands and when should you not use a space-couldn't find a good explanation, just text examples.

I don't use Terminal now but it looks fun and I want to learn, cautiously!!
Thanks,
Glen
 
Sorry, forgot to ask again........would you be able to answer my first question about why I have all those numbers in front of my name as below:
68-187-201-214:~ glenmccleary$
Thank you,
Glen
 
ElDiabloConCaca,

That is exactly what it is. I checked my network settings. How would that get into the computer name settings, since my understanding is that Terminal is not dependent upon any internet functions to apply?
Thanks....
 
It could be that that's your actual computer name -- you can verify this in the Sharing pane of the System Preferences.

Changing the name of your computer in the Sharing pane should also change the prompt in Terminal.
 
I checked the sharing prefs and the computer name is set as "my name's" iMac. That is what I thought was supposed to be in terminal.

Glen
 
The single quote (i.e. "Jeff's iMac") is an invalid character; or, rather, it should be "escaped" when using it in a bash shell string. Since it's invalid, the hostname in bash is probably defaulting to your IP address.

Try changing the name of your computer in the Sharing pane to something like "iMac of Jeff" instead of "Jeff's iMac" (or give it a clever name -- "Goliath" for a Mac Pro, "Frankenstein" for a heavily-modded Mac, etc.). Use upper- and lowercase letters, dashes (no underscores), and numbers only. Better yet, use upper- and lowercase letters only. That should clear it up.
 
Sorry for being so ignorant of terminal, the " " in the above were mine. Here is what the Sharing gives as the name: Glen McCleary’s iMac. Also message under the window states: Computers on your local network can access your computer at: glen-mcclearys-imac.local Did not want to confuse you with my quotes.

Thanks
 
I don't use Terminal now but it looks fun and I want to learn, cautiously!!

You might really like this product, then:

CLIX (free)
http://rixstep.com/4/0/clix/

CLIX (command line interface for OS X) provides a graphic interface for the command line. With one click you can find the function of a command and choose from its extensive commands database and it shows you the proper syntax. So you can learn how to use the command line without the danger of making a nasty mistake.
 
Randy-Thanks for the answers. I will look at Clix.....
ElDiabloConCaca-No, not the double-quotes encapsulating the computer name... the possessive, single quote between "McCleary" and "s".-I again apologize for my ignorance...burt I am not sure what you are saying here.
Thanks
 
The single-quote character is invalid in terms of a UNIX hostname. It is the 9th character from the left in the following string:

McCleary's iMac

...specifically, the single quote located between the 'y' and 's' characters.

Code:
M c C l e a r y ' s
                [b]^[/b]
                [b]^[/b]
                [b]^[/b]
That guy, right there, above the arrows. You need to get rid of that character in your computer name.
 
Thank you for the detailed, in depth response. I had already deleted 'it' and the IP code still remains in the Terminal window. I don't know if it really makes any difference, I am not on a network, but would like to get it right. Here is what is now in the local hostname box when I go to Edit (in the Sharing pref): Glen-McClearys-iMac.
 
When do you use a space in your commands and when should you not use a space-couldn't find a good explanation, just text examples.
 
You use a space when it's appropriate, and when you're separating different parts of the command string (such as the binary name and any arguments you supply to the binary).

You use a space when there's a space in a filename or a binary and you're either launching that binary or supplying that filename as an argument to a binary.

I'm not sure I understand your question fully -- it sounds like you're asking something like, "When do you use a space in a sentence?"
 
When do you use a space in your commands and when should you not use a space-couldn't find a good explanation, just text examples.

I think I can offer a simpler explanation.

Spaces separate arguments for shell commands, they're part of the syntax.

So if a file name (or any other part of the argument) contains a space itself you have to tell the command parser to ignore that particular space, not treat it as a separator.

A backslash \ tells the parser to treat the following character as a literal, don't interpret it, take it as is.

Enclosing an argument in double quotes "" tells the parser to treat all enclosed characters as literals, it's a string, don't attempt to parse it looking for instructions.
 
If you want to learn how to use OS X's command line, this product is phenomenal:

CLIX (free)
http://rixstep.com/4/0/clix/

CLIX allows you to use the command line by showing you how, without the fear that you will make a terrible mistake and do something you shouldn't.
 
Back
Top