Some Unix Knowledge

Ghoser777

Registered
I am by no means a java expert, but javac and java work fine on my slow, 333mhz imac with only 64 MB of ram - I even spanked the unix servers on our campus by a good five seconds when calculating primes.

I'm guesing your specific problem deals with calling classes that you've always assumed where there, but they aren't in OSX. Case in point: I can't get length.array to work. This is driving me CRAZY! It can't find the class length when I compile, so I have to keep passing the length of my arrays dirrectly. If any java professionals (as I am but a lowly introductory java student) out there know what classes are missing from osx and how to get them, I'd greatly appreciate the information.
 

Eid

Registered
Just had another flash of rememberance... If you want to see what commands you can do from the command line type in something like <a^d> (The ^ means control so I mean press & hold the control key, and press d) This will list all shell commands beginning with a

For example:
[b-fore:~] ben% a<^d>
ab alloc arch atrm
ac apache arp atstatus
accton apachectl at autodiskmount
activateSettings appleping at_cho_prn automount
addftinfo appletalk atlookup awk
addr appletviewer atos
afmtodit apply atprint
alias apropos atq
[b-fore:~] ben% a

Hope you guys find this handy

Eid
 

dani++

usin UNIX since '92
Hi,


the default shell is 'tcsh' afaik (i'm not booted into MacOS X)...

to try any other, just invoke them on the terminal app, type the following:
csh
sh

and so on. Anyway, I prefer tcsh to any other. Bear in mind that the behaviour of the different shell environments is slightly different.

 

boinger

Registered
Some corrections and elaborations...

Originally posted by Santiago
...Logging out from the terminal window:
kill -9 -1
This is BAD advice. You should definitely not get in the habit of doing this. I promise it will eventually cause you heartache.

You should think of "kill -9" to read "destroy violently". You don't want to have to be violent to your computer, but sometimes it's necessary. Only sometimes. Be kind to your loyal computer. Quit your terminal with logout, exit, CTRL-D (my fav) or COMMAND-Q (to quit all terminals).

cd.. Exp: Moves you back one dir
That's not true. cd.. isn't a command. What he meant to say was cd ..

While cd.. would have worked in DOS, this is Unix. See, in this case, cd is a command and .. is an argument being passed to cd. The command cd changes directories (cd /usr would go to the /usr directory, for instance) and .. means "whatever directory is below this one". It's "below" because the File System is thought of like a tree (that, for whatever reason, has no trunk). So, using this idea, the directory / is called the "root directory" and everything else branches off of it.

Sure, it sounds more like a shrub, but trees are cooler ;-)

But, back to the point, you have to separate your command from its arguments. that separation is a space.

rm *.* *1= x file *2= extension ie: .bin .txt etc
Again, this isn't DOS. What this command is saying is "delete every file that has a period (or 'dot') in it". Well, lots (and I mean LOTS) of files don't have a dot in them. And, also, this ignores all files that start with a dot (such files are "hidden", as you generally don't mess with them on a day-to-day basis, so, they're just kept "out of the way"). What this should have read (to really delete absolutely everything, including subdirectories) is:

rm -r .* *

rm is the command
-r means "recursively" (meaning "all of the subdirectories, too)
.* means everything starting with a dot
* means everything not starting with a dot

You should obviously be very careful when doing this.

ping (Network IP) Pings the IP you specify in numbers. Might work with letters.
I assume he means "DNS Name" by "letters". And, it certainly does work with DNS names. My personal standard for making sure the Network is functional is ping yahoo.com because yahoo is almost never down.

A few other commands that I am a big fan of are:

pwd
Tells you what directory you're in.

cd ~
That "squiggly" is a tilde (you can say "TILL-duh" or "TILL-dee", depending on where you're from ;-)) - to make it, it's SHIFT-key.just.to.the.left.of.the.1 - what this command does is takes you to your "home" directory. That is, the directory that you go to when you start up a new terminal window. usually /Users/username in Mac OS X (it's /Users/boinger for me, for instance)

cd -
This means "change to whatever directory I was just in" - it's for "flipping between" two directories. So, if you are in /usr/local/bin pokin' around, and you decide you need to go to your home directory for a second, you can get back to /usr/local/bin with cd - instead of having to type cd /usr/local/bin again. neat, eh?

hostname
this tells you what machine you are on. good for if you're ssh'ing (or, *cough* telnetting, for the brave) to a bunch of different machines in a bunch of different terminal windows

whoami
Tells you what user you are. If you're doing potentially dangerous stuff, make sure you are who you think you are.

I think that's about it for now - for this essentials, anyway.

If you wish you knew how to do something, but just can't figure out how (or if), please ask - I am both a Mac Zealot and a Unix Sys Admin (don't find too many of us around), and I am very excited about this OS and will help it gain acceptance and increase useability for its users any way I can.

--boinger
 

budncal

Registered
The default, which is what you get in the Terminal, is tcsh. OS X also has csh, zsh, and I believe also bash.
 

boinger

Registered
Originally posted by budncal
The default, which is what you get in the Terminal, is tcsh. OS X also has csh, zsh, and I believe also bash.
bash isn't in OSX by default - You have to grab it from the Darwin 1.0 img and copy it into place (usually /usr/bin or sometimes /usr/local/bin).

Though, it SHOULD be there - it is, of course, the "best" shell! (for me, anyway)

--boinger
 

ismail

Registered
Hello,
Well, first open Terminal.app Preferences. In the Shell Preferences change /bin/tcsh to /bin/zsh ( I'm using zsh), or the path of the Shell you'd like to use.

That is done, now you need to change the Shell in the users database which resides on NetInfo database.

NetInfo is in the Utilities Directory under Applications.

Start NetInfo, authenticate yourself using the root password, now you can edit NetInfo. Don't mess around, you don't want to play with things you don't know about here.

You'll see a navigation view of the database, scroll down getting to users. Click on users, then on your username. You'll have all your info displayed. Scroll down if you don't see all your info to get to SHELL, now change it to the same thing you changed it in the Terminal.app Preferences. Save changes, Restart NetInfo processes.

You are done.
 

andredeb

Registered
Then again... real Unix programmers use emacs ;-)

From within emacs you can navigate around the file
system with lightspeed, start compilations, perform
debugging and that all (almost) without typing in
the commands. The apple developer tools may soon
make emacs extinct but I don't believe till I see....

Emacs is pre-installed on OS-X, full documentation
can be found here:

http://www.gnu.org/manual/emacs/


A "how to get started... now" guide can be found here:

http://www.go-ebusiness.com/emacs_intro.htm
 
Top