Mac - unix terminal

From NoskeWiki
Jump to: navigation, search

MAC OS X Terminal Window

NOTE: This page is a daughter page of: Unix


The terminal window on Mac is under: Applications > Utilities > Terminal NOTE: There is also an X11 window here which is similar Drag this onto the dock (so it's easier to access) and click it to start a new shell (Shortcut = [Apple]+[N])


Use File > Show Info to change the appearance (color, transparency, etc) and click "Use Settings as Default".

The default shell is usually tsch. To see what shell is default:

echo $SHELL

... you can change a shell to "bash" or "csh" by simply typing it.


Changing Environmental Variables in Terminal

I had some trouble with this a while ago. PATH is a special environmental variable which lists commands that can be called (without typing the full path).. to see the current value type:

> echo $PATH
/bin:/sbin:/usr/bin

As you can see PATH contains a list of folders (where commands reside) seperated by colons. To ADD a new folder to PATH you can type:

> set PATH=/usr/local/Trolltech/Qt-4.2.2/bin:$PATH

OR

> setenv PATH /usr/local/Trolltech/Qt-4.2.2/bin:$PATH

However, I've found this does not take immediate effect for the current shell, and is erased when you close and start a new shell. To make the change permanent you can modify .profile (if your shell is bash) OR .login / .cshrc (if your shell is csh or tcsh). To do this type:

> pico ~/.login

DON'T be surprised if this file doesn't exist yet (and there is nothing in it)! Using pico (or your editor of choice) add the line:

setenv PATH /usr/local/Trolltech/Qt-4.2.2/bin:$PATH

Now create/save the file and exit (in pico: click [Ctrl+O] to save and [Ctrl+X] to exit). To view it use:

> cat ~/.login

Now close Terminal, open it again, check that echo $PATH includes the new folders, and you should be able to use/access commands in that folder.


Other Operations

To log into someone's computer on the network:

ssh bjm-Golgi

(using the computer's name)

To kill process:

use top to get process ID then run kill -9 1734 (-9 is more powerful).


See Also

Links