All proceeds from Ad Clicks goes to the author of this site.

 

Tuesday, March 01, 2005

helping a Linux Convert.

Since Tim Bray doesn't have his comments enabled on his Blog. I will comment here, and it might even help a few others as they move to Solaris.

[snipped]

plus-plus> Bash, Or Not Once connected I quickly concluded that the default shell > was bash, which made me happy. Except for, I copied over my >.bashrc >from the laptop, and it didn’t work. All the PS1 and PATH
> settings >worked by hand if I typed them in... hmm. So I reached back into my Unix
> past and put > them in .profile instead, and there I was.

> This isn’t bash at all, it’s the “Posix Shell”; but bash-lovers will feel at home. The
> choice of shells is less important these days now that we have command-line editing. It > has the important stuff like control-Z and bg/fg and the good old for/do/done loop
> syntax and >&.

If you want bash, its installed just type bash it lives at /usr/bin/bash.

minus-minus> Directory Hell A lot of commands I wanted to use (ping and wget were > the first two I think) weren’t where I expected them to be. It turns out
> the commands in Solaris are splashed over a bunch of different
> directories. Bryan Cantrill had pointed out some helpful stuff in /opt/csw/bin but I
> didn’t have one, but that was OK because I do have /usr/sfw/bin, and some of stuff
> he was talking about was there.

> That’s OK, nothing a little environment hacking (don’t forget MANPATH) won’t solve.
> But, uh, why? Do these directories actually serve any purpose other than to confuse
> newbies?

There are a few reasons why they spread files all over the place.

- It gives sys admins better control who has access to what files.

- They can offer users more choice. If you want gnu based commands there in /usr/sfw/bin but if you want an older style check in /usr/ucb or /usr/ccs/bin

- Multiple small directories are faster to search than a couple big directories

plus-plus> Man Pages In both OS X and Linux, from time to time I come across a
> missing or vestigial man page. Solaris seems to take this real seriously;
> they all seem to be there, and a bit more polished too.

> Of course, like all Unix man pages, they are designed to answer “What are the precise > effects of this command?” rather than “How on earth do I do XXX?”, but that’s just the > way things are.

minus-minus> Two-Letter Command Surprises Well, you gotta use ps if you’re going > to accomplish anything on a Unix box, right? I mechanically typed
> ps axuwwww | grep tb
> which is my usual way of asking “what do I have running?” and realized that that
> mouldy old stuff doesn’t work any more. What I wanted, of course, was
> ps -ef
> and I didn’t even have to look it up, those options were there in some dusty memory
> closet with dim letters on the door spelling, I think, “System V”.

Or you could have used the ps that is installed in /usr/ucb/bin it supports the options you are more familiar with –axuwwww | grep tb

> Then I wondered about my disk setup and typed
> df -k
> Ouch! Here’s the output on the tbray.org Debian box:

Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hda3             78044612  17655608  56424564  24% /
/dev/hda1                77749      8070     69679  11% /boot

> Here’s what Solaris gave me:

Filesystem            kbytes    used   avail capacity  Mounted on
/dev/dsk/c1t1d0s0    69529218 2636826 66197100     4%    /
/devices                   0       0       0     0%    /devices
ctfs                       0       0       0     0%    /system/contract
proc                       0       0       0     0%    /proc
mnttab                     0       0       0     0%    /etc/mnttab
swap                 2705728     624 2705104     1%    /etc/svc/volatile
objfs                      0       0       0     0%    /system/object
/usr/lib/libc/libc_hwcap2.so.1
                     69529218 2636826 66197100     4%    /lib/libc.so.1
fd                         0       0       0     0%    /dev/fd
swap                 2705112       8 2705104     1%    /tmp
swap                 2705128      24 2705104     1%    /var/run
XXXXXXXXXXXXXXXX     244169857 213739676 27988483    89%    /home/tbray

> Say what? There’s something called swap mounted on both /tmp and /var/run
> (whatever that is)? I’ve censored out the bits that reveal perhaps too much about the
> internal structure of our intranet.

Swap is really just solaris’ way of saying it’s a ram disk, that uses ram/swap as needed to store the files. /tmp and its friends hold data that is only kept around for short period of times and tend to be small and accessed a lot, so Solaris uses the fastest storage method available Ram.

> OK, two things bit me: first of all, it turns out that on Solaris, the -k option, instead of > just making sure you’re seeing k-blocks rather than 512-byte blocks, radically changes > the output (leave it out and the result is less confusing). Second, they use the filesystem > abstraction much more aggressively; for example, Linux has /proc too, it just doesn’t > show up as a mount point.

/proc used to show up in df, as did a few others that linux uses. Too see what is really going on in Linux, try df – a. Also if you are reading df output as a human its best to use df –h in both Linux and Solaris.

> I’ve tagged this with a -- not because there’s anything intrinsically wrong with the
> Solaris way of doing things, it’s just something that’s going to confuse a Linux hack
> like me.

minus-minus> pkg-get Bryan told me that if I wanted any open-source software that
> doesn’t come with Solaris, this was the way to get it; seems to work
> about like apt-get, which I’ve always regarded as the supreme
> achievement in the universe of release engineering.

> Except for, it wasn’t there, so I had to go get it from Blastwave.org, which meant I had > to go find wget, and then figure out how to tell it to use the Sun Intranet HTTP proxies, > which is how I found about all those weird directories where the commands are hiding.

> Uh, guys, why? If you need this tool to use Solaris, why doesn’t it come with Solaris?

Because once again, Solaris offers you a choice. There are 3 great ways to get freeware/opensource programs for your Solaris system.

- Sun Freeware Companion Disk

- www.sunfreeware.com for people that want to have more control over what is installed on there system. User handles dependencies.

- www.blastwave.org run by my friend Dennis Clarke, not Sun.

> Grr... but they told me they were shipping a compiler!

> Oh, wait, he said GCC.

plus-plus> cc, Chapter Two

zep01 505> gcc -o hello hello.c
zep01 506> ./hello
hello world
zep01 523> which gcc
/usr/sfw/bin/gcc

> Hmm, it really seems wrong that cc is missing. Let’s see...

[snipped]

Sun does offer a Compiler but its currently a $3000, because it’s a commercial quality Compiler. But if you are a serious about programming its worth it. It produces faster/better code.

For help and quick tips check out

http://uadmin.blogspot.com/2005/02/ben-takes-us-on-quick-tour.htm

http://www.cuddletech.com/blog/pivot/entry.php?id=65

if you have any other problems feel free to visit #opensolaris at irc.freenode.net.

0 Comments:

Post a Comment

<< Home