What's the Solaris equivalent to the BSD's 'tail -n100'? What's the Solaris equivalent to the BSD's 'tail -n100'? unix unix

What's the Solaris equivalent to the BSD's 'tail -n100'?


Just remove the "n"

tail -100


Or you can use:

/usr/xpg4/bin/tail

which does behave like you want (tail -nN).

xpg4 = Xopen Portability Guide Issue 4, contains binaries strictly compliant with several POSIX and other standards. The differences with the former ones are usually details in options supported and behavior.

According to your distribution, there is also /usr/xpg6/bin, /usr/openwin/bin (OpenWindows commands), /usr/dt/bin (CDE desktop commands), /usr/sfw/bin (Solaris freeware) and various other.

For instance, Solaris Express is introducing /usr/gnu/bin to provide Gnu binaries with their custom extensions and specificities.


Cross-platform variant of tail -n 10 for scripts:

sed -e :a -e '$q;N;11,$D;ba' file

This works the same for Linux and Solaris.