1830165 Members
5957 Online
109999 Solutions
New Discussion

awk

 
SO_1
Occasional Advisor

awk

Waht is the difference beetween
/sbin/awk & /usr/bin/awk ?
besides exec size :
# ll /sbin/awk /usr/bin/awk
-r-xr-xr-x 1 bin bin 598016 Mar 11 2004 /sbin/awk
-r-xr-xr-x 1 bin bin 180224 Aug 27 2004 /usr/bin/awk
8 REPLIES 8
Mark Greene_1
Honored Contributor

Re: awk

# file /sbin/awk
/sbin/awk: PA-RISC1.1 shared executable
# file /usr/bin/awk
/usr/bin/awk: PA-RISC1.1 shared executable dynamically linked

What OS version and patch level do you have?

mark
the future will be a lot like now, only later
A. Clay Stephenson
Acclaimed Contributor

Re: awk

The difference between utilities in /sbin and those in /usr/bin is that the /sbin versions are statically linked. This make them less efficient in memory use BUT makes it possible for them to execute before shared libraries (generally found in /usr/lib) are available because the filesystems that house them have not yet been mounted. Important utilities that are needed in single-user mode are statically linked and placed in /sbin.
If it ain't broke, I can fix that.
TwoProc
Honored Contributor

Re: awk

If you do a "what" command on each of them I think you'll find that they are both the same version. I would think that the one in /sbin/ is fully linked, and the one in /usr/bin/ uses shared modules (like demand load libraries) at run time. That would explain the difference in executable size. This would be useful b/c HP boxes don't come up in single user mode with /usr mounted. So, it's part of the tool set for admins (sbin probably stands for system bin) which would presumably be mountable during single user operations while the /usr partition is being worked on, or unavailable for whatever reason.
We are the people our parents warned us about --Jimmy Buffett
Sandman!
Honored Contributor

Re: awk

Hi,

Doing an ldd on the awk executables should confirm that one is statically linked and the other is dynamically linked.

# ldd -v /sbin/awk
<...should say not a shared executable>

# ldd -v /usr/bin/awk
<...should show the shared library dependencies>

cheers!
SO_1
Occasional Advisor

Re: awk

Thank you everybody,

I was expecting something like that
but I was not sure because on Solaris there is awk & nawk in several places, with each a different behavior...
I'll chose /usr/bin/awk to put in my scripts
A. Clay Stephenson
Acclaimed Contributor

Re: awk

Then you should have asked your question like that. Under HP-UX awk is nawk. After all, n(ew )awk has been around now for decades.
If it ain't broke, I can fix that.
TwoProc
Honored Contributor

Re: awk

How did a rabbit get assigned with no points?
We are the people our parents warned us about --Jimmy Buffett
A. Clay Stephenson
Acclaimed Contributor

Re: awk

It's not a bug; it's a feature. Closing a thread automatically assigns a Bunny Wabbit.
If it ain't broke, I can fix that.