4

So we just recently moved to a host that is based on opensolaris rather than a variant of linux. I've found that there are a bunch of commands that don't operate the way I'm used to on linux machines. I'm just wondering what command equivalents others use in linux and opensolaris and vice versa.

Some examples: (linux -> opensolaris)

 ifconfig               -> ifconfig -a
 grep -r "pattern" dir/ -> find dir/. | xargs grep "pattern"

One in particular I'm still trying to figure out:
netstat -tnlp -> ??
(-lnpt shows the listening (-l) process (-p) name, pid and the numerical addresses (-n) of all tcp (-t) connections)

Silfheed
  • 168
  • 3
  • 13

5 Answers5

11

I use the Rosetta Stone for Unix as my resource for looking up commands on an OS when I know what I want to do but I only know the command on another OS.

It's absolutely brilliant. Select the OSes that you're interested in and click 'Draw table'. It'll cut down the table so all you see is, say, Linux and Solaris.

MikeyB
  • 39,291
  • 10
  • 105
  • 189
4

Many good links to command translations (Linux -> OpenSolaris) are listed on the Sun wiki. (Check the bottom of the page for links)

Differences between OpenSolaris and Linux

Dave K
  • 2,751
  • 2
  • 21
  • 17
1

You can get gnu versions of many tools (the same versions as available on linux) installed on solaris, and may have them installed already. A good rule of thumb is to try putting 'g' before the name of the command you are interested in: gtar, ggrep. These of course require the right packages installed - SUNWgtar, SUNWggrp for the examples above on Solaris 10. Take a look in /usr/sfw/bin (and add it to your path if it isn't in there already) to see what tools you have available. Not everything is available this way, and some commands (such as the ifconfig one mentioned above) you just have to learn the different command variants (ifconfig -a works on linux too).

The other common one that I find myself having to remember is the ps syntax to view all processes: BSD: ps ax, Solaris: ps -ef, Linux: either syntax works. On a related note - use pkill instead of killall to kill all processes with a certain name. Killall on Solaris does what the command name suggests and kills all processes, not just those you name.

Mark
  • 2,856
  • 20
  • 13
1

I come from a dpkg/apt world (Debian/Ubuntu) so I created a nice cheat sheet when learning about OpenSolaris package management (IPS).

APT                    IPS
apt-get install        pkg install
apt-get remove         pkg uninstall
apt-cache search       pkg search
apt-get update         pkg refresh (mostly redundant, pkg refreshes before installing)
apt-get dist-upgrade   pkg image-update
editing sources.list   pkg publisher / pkg set_publisher / pkg unset_publisher 

This is based on an outdated page at OpenSoalris.org comparing apt & IPS.

notpeter
  • 3,515
  • 2
  • 26
  • 44
1

In general, I think you're going to find that opensolaris doesn't have as many 'convenience' features as linux does; your two examples above are also both good examples of this.

pjz
  • 10,595
  • 1
  • 32
  • 40