Skip to end of metadata
Go to start of metadata

If you're coming to a SmartMachine from Linux, you may find that some things are a little different than what you are familiar with. The SmartOS has most of the GNU tools that you are accustomed to, just that they are not default tools. The SmartOS used on Smart Machines is a major fork of OpenSolaris, much as Ubuntu is a major fork of Debian Linux, so the default is to use its own tools. Your fingers' muscle memory may find the differences a little unsettling at first, but rest assured that everything you're used to is still here. It's just in a different place, or it may have a different name.

Where things are

Most things are where you expect them to be. The following table lists the directories you'll find in your PATH variable.

Directory Description
/opt/local/bin
/opt/local/sbin
These directories contain the GNU tools as well as other tools installed on top of the standard system tools. When you install software with pkgsrc, this is where it is installed by default. On other systems, this would be /usr/local/bin.
/usr/xpg4/bin This directory contains the basic Unix tools such as rm, ln, etc
/usr/bin
/usr/sbin
These directories contain standard Unix tools.
/usr/sfw/bin Third-party packages from http://www.sunfreeware.com. You can find gcc here.
/usr/openwin/bin This directory contains X11 binaries.
/opt/SUNWspro/bin This directory, if it exists, is for the Sun C compiler. It's not normally installed.
/usr/ccs/bin This directory contains additional tools for the Sun C compiler.

Other directories you may be interested in are:

Directory Description
/home User home directories.
/home/admin Home directory for the admin user.
/home/jill Home of the jill user (the website owner user).
/home/jill/web/public This is where website files reside (the 'document root').
/root/bin Contains useful tools for system information.
/shared If you have purchased extra NFS storage, it will be mounted here.
/var/adm System logs. Other logs, such as httpd logs, are in /var/log.
/usr/local This is a symlink to /opt/local.

Commands that work differently

The things that make a SmartMachine different from other Unix-like systems generally fall in
two categories:

  • commands that have different names on SmartMachines
  • things that are done differently on SmartMachines

For example, here are some common Linux commands that work differently.

Command What's different on a Smart Machine
df The default is to us the SmartOS version.  gdf may provide an output more familiar to Linux users.
free
The /root/bin/jinf tool provides this information and more.
locate This is a GNU tool, so it has been renamed to glocate. Likewise, you would use gupdatedb to set up its database.
lsof SmartMachines use a different collection of tools to examine processes. See Examining processes and memory later in this topic.
ping Returns whether a host responds or not.
Use ping -s to get the continuous response you're used to
top top is available in /opt/local/bin, but prstat -Z provides more zone aware (and more accurate) information than top.

The Rosetta Stone for Unix is a useful page to help you find the equivalent command from the version of UNIX you are used to. The GNU Tools
You can find the GNU tools in /opt/local/bin and /opt/local/sbin. However, many of the tools have been renamed to have a "g" prefix. For example, invoking tar runs the native Smart Machine version of tar. To invoke the GNU version of tar that you're used to, you would use gtar instead.

If you're not sure whether you're using a native tool or a GNU tool, use the --version argument. All of the GNU tools display version information. The native tools usually do not.

You can easily customize your environment by creating aliases in your .bashrc file and restarting your session:

Examining processes and memory

These commands in /root/bin provide information about ports and resources. Run these commands as root or with sudo.

Command Description
/root/bin/pcp Displays the ports used by a process, or the processes that use a port.
/root/bin/pcp -p 80 displays all the processes that use port 80.
/root/bin/pcp -P 28068 displays all the ports that process 28068 uses.
/root/bin/pcp -a displays port and process information for all ports.
/root/bin/jinf Displays information about how your SmartMachine is using its resources.
/root/bin/jinf -c displays CPU usage information.
/root/bin/jinf -m displays memory usage information.
/root/bin/jinf -s displays swap usage information.

SmartMachines use a suite of tools to examine processes. You can learn more about them by looking at the proc man page.

Tool Description
prstat This tool displays the active processes like top does on Linux systems.
prstat -Z will provide you with a summary of your SmartMachine's status.
pgrep Returns a list of process IDs (PIDs) of processes that match a pattern or meet certain conditions.
pkill Kills the processes that match a pattern or meet certain conditions.
pfiles Returns a list of all the open files that belong to a process.
pstack Displays a stack trace of the specified process
ptree Displays a process tree for all processes or a given process
ls proc Lists the process IDs of all running processes.

You can combine the results of pgrep with the other proc tools. To list all the files associated with http processes, use this command instead of lsof:

To limit the prstat display to http processes, use this command:

If the prstat display changes your terminal settings, use the reset command to return them to normal.

Starting and stopping services

On other systems, you may be used to starting and stopping servers by using commands
in /etc/init.d. SmartMachines use the Service Management Facility to do this.

The svcs and svcadm commands are the ones you'll use most often. Some commands
take a service identifier, called an FMRI. You can use the svcs command to list
all of the services's identifiers.

Command Description
svcs Lists all the enabled services
svcs -a Lists all of the services, even those that are disabled or off line
svcadm enable http Enable all of the processes with an http FMRI
svcadm disable http Disable all of the processes with an http FMRI
svcadm restart http Restart all of the processes with an http FMRI

For example, if you make changes to /etc/ssh/sshd_config, restart SSH like this:

Installing Sofware

There are two ways to install additional software on your SmartMachine:

  • install it from a package
  • compile it from source

Installing Software From a Package

SmartMachines use a package manager called pkgsrc to manage the installation of software. If you are familiar with Debian or Redhat Linux, pkgsrc is similar to apt, rpm, or yum. Joyent maintains a repository of packages that you can install on your SmartMachines using pkgin.

This table lists the common pkgin commands.

You need to run the commands that install software or update the package database as the root user or as admin using sudo.
Command Description
pkgin up Updates the pkgin database. You should run this command before installing any new packages just in case.
pkgin ls Lists all the installed packages
pkgin av Lists all of the available packages
pkgin in Installs a package
pkgin rm Removes a package
pkgin se Searches for a package
pkgin With no additional arugments, lists all of the available pkgin commands.

For example, to install tidy, you run this:

Compiling Software From Source

If the software you want to use isn't available as a prebuilt package, you can compile it from source. Typically, you'll get a tarball that contains the software you want to install. After you unpack the tarball, the readme file will contain instructions for compiling the software.

For example, to install the lastest version of Ruby on your SmartMachine, you would use the following commands. Note that we're using the GNU versions of tar and make.

External Links

Some really good links that we have found that make the SmartOS more familiar.

Solaris Eye for the Linux guy... or how I learned to stop worrying about Linux and Love Solaris (Part 1)

At a Glance

SmartMachines are based on OpenSolaris, so Linux or BSD commands may not be where you expect them to be. This topic tells you where to find what you need.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.