Question regarding terminal

Status
Not open for further replies.
Joined
Jun 2, 2003
Messages
23,591
I need to enter a few commands in the terminal, and the commands that I am supposed to enter contain some spaces. Do these spaces matter?

The commands that I am supposed to enter in one line are shown broken up in two lines. I don't know if there needs to be a space between the two parts when I type the command into one line.

This is on Mac OS X.
 
Yes, you need spaces where they are shown.

There most likely needs to be a space between the two parts. If a long line must be broken up for readability or to fit it in a publication, the standard is to break it up at a space.
 
You can also terminate one line with a "\" and continue typing on the next line; when the command is complete, a will execute all the lines as if typed on one line; consecutive commands executed are delimited by a ";"

$ echo "Mori needs help" ; \
> echo "Mori needs more help" ; \
> echo "Mori needs less help"
Mori needs help
Mori needs more help
Mori needs less help
$
 
Last edited:
Sadly, mori needs more help. This time with setting up the Airport. Got WEP key, but no go connecting to the net.
frown.gif
 
Originally Posted By: simple_gifts
You can also terminate one line with a "\" and continue typing on the next line


I've never had a need for that, though I suppose it would be useful for those terminals that don't wrap to the next line automatically. (I haven't seen one of those in a long time).
 
I have zero experience using the terminal. I only know here to find it. Should I make a mistake in the terminal (in OS X 10.4), what will happen? I often read the warning that making a mistake in the terminal can be fatal to the computer, but I don't buy it. Do I get an option of going back and fixing the mistake?
 
Since you are not logged in as a priv'ed user, no mistake you make @ the terminal can be fatal to the computer; it can be, however, fatal to your saved files.

Caveat: Any command you type with a "sudo" in front will be running as a priv'ed user; it is short for super user do.
 
What's a privileged user? It's my computer. I should be privileged! Is it someone who knows what he's actually doing in the nether regions of the computer?
wink.gif


What saved files can be destroyed? Any that are on the computer?
 
A privileged user is one who can modify system files, system settings, install software system wide and modify ALL users data.

IIRC, Apple's security model makes a priv'ed user a role that certain users are authorized to take on. When updates are available, OSX notifies you and when you try to update the computer, you must supply your password; this now allows the update program to operate in a priv'ed context and install the updates. Users who do no have this role cannot update the computer.

The privileged account on Unix machines (OSX is a Unix variant) is termed "root"; however Apple has chosen not to allow the "root" user to log in directly. The privileges must be gained from another user account. This is far superior than "another" OS's security model which allows the administrator to log in directly and even surf the web with full privileges invoked because

1) there is no default admin account which hackers know the name of (Windows has an Administrator account name "Administrator" by default unless renamed.

2) Heightened privs are granted ONLY for the actions for which they are needed. User can't "surf the web" with full privs. These heightened privs are available ONLY TO THE PROCESS that needs them.

OSX is good because it has a slick windowing interface built on a rock solid Unix. Apple has chosen to hide 99.99% of the "unixy" stuff underneath and provide a GUI to do everything; The "Terminal" is your window to the underlying OS and rich toolset. You can manage files, edit data, launch applications all from the Terminal window.

Quote:

What saved files can be destroyed? Any that are on the computer?


No, just the ones you own. (pictures, MP3's) From the terminal window you can delete files with a command I will not mention here. You also can rename them, copy them, move them between folder; all the stuff you do with the GUI, but it is done with text commands.

Unix is unforgiving; It respects user boundaries between different users, but you are free to blow off your foot with your own files; it will not stop you.

For starters open a Terminal and type

ls

This will list your files. (if you are skeptical or fearful type "man ls" and that will display the man (aka help) page for the ls command.

ls -l (ls minus l) will give you a long list of files (dates included) and so on

Here is a VERY short list of what is available.

http://www.ss64.com/osx/
 
Last edited:
So you mean as long as I don't log in as a privileged user I can't do harm? It doesn't look like I need to log in if I want to use the terminal. I always have to log in when installing OS and other updates.


You say I can destroy only files that I own. Sorry for sounding like the idiot that I am, but what files on my computer don't I own?
 
Quote:

but what files on my computer don't I own?


the OS kernel, networking config files, your sigother's files, application programs etc. When you are logged in you "are logged in" Starting a terminal is just another program that you are running (which happens to allow you to run other programs)

Unix is a multiuser system. You may have purchased the computer, but you are just a guest when it comes to using it. 8)

$ cd /usr/bin (move into a system area)
$ rm lprm (try to delete a file there)
rm: remove write-protected regular file `lprm'? y
rm: cannot remove `lprm': Permission denied
$

BTW "rm" is the command to delete files, but I said I would not tell you. See, the system says "u-uh, can't delete, you don't own it"

For kicks open a terminal and type

cal

then

cal 3 2009

then

call 2009

How does a GUI make this easier?
 
Last edited:
Originally Posted By: simple_gifts
You may have purchased the computer, but you are just a guest when it comes to using it. 8)


I must be an unwanted guest.
LOL.gif


Thanks for shining a light on this. I'm still very much in the dark so I won't be experimenting. I'll only do what I must do.
 
Status
Not open for further replies.
Back
Top