The commands to know to get started
┌
Discover your system
Display available memory:
prtconf | grep Memory
Display the components of your computer: (exhaustive list!)
prtconf -v
Display your computer's model, its CPU, RAM, etc..
prtdiag
Display consumed resources:
vmstat
Display live memory and swap usage (equivalent of a tail -f..)
sar -r 5 10
Display IP configuration:
ipadm
Display your network cards:
dladm show-phys
Display your USB devices:
iostat -En
or
parted -l
or (but be careful not to format your drives afterwards... press CTRL+C to exit!)
format -e
On OI/OmniOSce, disks have a nomenclature of type cXtXdX
Disk partitions have a nomenclature of type cXtXdXpX Make sure to read the article dedicated to formatting drives carefully.
┌
Manage packages
Another newsletter 'How to use the package manager' exists.
Have a look at it.
Install a package:
pkg install PACKAGE-NAME
Search for a package in the repository
pkg search PACKAGE-NAME
Uninstall a package:
pkg uninstall PACKAGE-NAME
Know the contents of an installed package (where its files are copied on your system)
pkg contents PACKAGE-NAME
Display the repositories configured on your system
pkg publisher
List all the packages available in a repository:
pkg list -f -g http://pkg.......
Update all your packages: (Be careful, this is equivalent to "apt update && apt upgrade" on Debian and "pkg update && pkg upgrade" on FreeBSD! and not "apt update" or "pkg update")
pkg update
Enable/Activate the service:
svcadm enable SERVICE
Disable/Deactivate the service:
svcadm disable SERVICE
Restart a service
svcadm restart SERVICE
List all services (activated and deactivated).. Useful for spotting the desired service name:
svcs -a | less
┌
Boot environments and system snapshots
Create a boot environment:
beadm create BOOT-ENV-NAME
Activate a boot environment (for the next restart):
beadm activate BOOT-ENV-NAME
List boot environments
beadm list
Create a system snapshot:
beadm create BOOT-ENV-NAME@SNAPSHOT-NAME
Display all snapshots of a BE (boot environment):
beadm list BOOT-ENV-NAME -a
Instantly restore your system to a previously taken snapshot:
beadm rollback BOOT-ENV-NAME@SNAPSHOT-NAME
┌
User management
The default base directories for users are located here:
/export/home/USER on OpenIndiana, and /home/USER on OmniOSce
Display the list of users
getent passwd
Display the list of groups
getent group
create a user with their personal directory in /export/home/
useradd -m marcel
create a user with a custom personal directory, add it to the already existing group 'suprgrp', block him from logging :
useradd -G suprgrp -s /bin/false -d /SFTP/marcel marcel
Activate the user's session (and change his password)
passwd marcel
Delete a user
userdel marcel
Create a group (admins)
groupadd admins
Add a user to a group :
usermod -G thegroup myuser
Remove a user from a group :
Open /etc/group, search for the group line and manually remove your user. It is the fastest way.
┌
Manage Modules
Modules are located either in /kernel/drv or in /usr/kernel/drv.
Display the list of loaded modules:
modinfo | less
To load a module (for example, the vmm module for bhyve... well, in reality, it's automatically loaded during the installation of bhyve, but it's just for the example!)
modload -p drv/vmm
(putting -p first searches in /kernel/drv, and if it's not found there, it then automatically looks in /usr/kernel/drv... quite handy! In this case, vmm is located in /usr/kernel/drv).
To unload a module: you need to know its ID. For that, rerun the modinfo command:
modinfo | grep vmm
265 fffffffff7da0000 323e9 264 1 vmm (bhyve vmm)
(the ID of vmm is the number on the left)
modunload -i 265
There you go, the vmm module is unloaded.