---
# System prepended metadata

title: System

---

# System
[TOC]
## BSD Family
### [FreeBSD](https://www.freebsd.org/)
- Feature: 功能性強大、適合各種用途
- Aims to be usable for any purpose.
- It supports a large number of applications.
#### Config SOP
> IP addr: 10.21.20.137
- `w`/`who`/`user`
	![](https://i.imgur.com/VJ5ZIBb.png)
- Network
	- `ifconfig`
	- `sockstat -l`
	- look `/etc/services` to check services' port num
- SSH
	- You can enable while booting
	- Or add `sshd_enable="yes"` in `/etc/rc.conf`
		- Then run `/etc/rc.d/sshd restart`
	- Config details in `/etc/ssh/sshd_config`
- Install
	```shell=
	pkg install packagename
	```
- User
	```sh
	pw user add sai -G wheel
	```
- wheel
		```
		pw group mod wheel -m username
		```
- `uptime`
- `last -1 reboot`

#### Info after booting
- `uname -mrs`
	```
	FreeBSD 13.0-Release amd64
	```
- `du` at `/`
	```
	1959727 .
	```
	> 1.9 GB
- `df -h`
	![](https://i.imgur.com/eC6LqUk.png)

- `dmesg | grep memory`
	![](https://i.imgur.com/0N9RU10.png)
- `sysctl -a | grep mem`
	![](https://i.imgur.com/X9G0yuB.png)
- `swapinfo`
	![](https://i.imgur.com/V2OuR41.png)

![](https://i.imgur.com/vPftCgf.png)

### [OpenBSD](https://www.openbsd.org/)
- Feature: **High security** --> strict Open-source license
- Aims for maximum correctness in code, bringing simplicity and security.
#### Config SOP
- Network
	- `ifconfig`
- SSH
	- Enable while booting
	- Or, [OpenSSH for OpenBSD](https://www.openssh.com/openbsd.html)
- User
- [**Doas**](https://www.openbsdhandbook.com/system_management/privileges/#doas)
	```
	$ doas [command]
	```
	- The doas tool is the OpenBSD implementation of the well known sudo tool.
	- The configuraton for doas can be found in `/etc/doas.conf`.
	- The default config will allow all users in the group “wheel” to execute commands as the root user.
- File path
#### Info after booting
- `uname -mrs`
	```
	OpenBSD 7.0 amd64
	```
- `du` at `/`
	```
	2089736 /
	```
	> 2 GB
- `df -h`
	![](https://i.imgur.com/zcXZVqC.png)

- `sysctl -a | grep mem`
	![](https://i.imgur.com/Q8WLfcO.png)
- `top`
![](https://i.imgur.com/oZhjLRe.png)

### [NetBSD](https://www.netbsd.org/)
> The name "NetBSD" was chosen based on the importance and growth of networks such as the Internet at that time, and **the distributed, collaborative nature of its development**.
- Feature: **Lightweight** --> 空間節省、可移植性高，適用於嵌入式系統
- Aims for maximum portability.
- `pkgsrc`
	- A centralized package management system for Unix-like operating systems.
	- Before such software can be used, it needs to be configured to the local system, compiled and installed. Also help to handle binary packages
	- [The pkgsrc guide](https://www.netbsd.org/docs/pkgsrc/introduction.html#introduction-section)
#### Config SOP
- Network
	- In NetBSD, DHCP service would not be enable by default. If you want to let NetBSD server request for a IP address from DHCP server. Add following lines in `/etc/rc.conf`:
		```
		dhcpcd=YES
		dhcpcd_flags="wm0"
		```
	- Then
		```bash=
		service dhcpcd start
		```
- `pkgin`
	- `pkgin` is the primary high level tool for managing `pkgsrc` binary packages, designed to be familiar to users of other package managers such as `apt`.
	- Set the *PKGPATH* and install `pkgin` if it isn't installed already.
		```shell=
		PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f '1 2' -d.)/All/"
		export PKG_PATH
		pkg_add pkgin
		```
:::info
Now you can install package with command **`pkgin install`**
:::
- `pkgsrc`
	- Get `pkgsrc`
		```shell=
		CVS_RSH=ssh cvs -danoncvs@anoncvs.NetBSD.org:/cvsroot checkout -P pkgsrc
		```
	- bootstrap
		```shell=
		cd pkgsrc/bootstrap
		unset PKG_PATH
		./bootstrap --prefix /opt/pkg-2021Q2 --prefer-pkgsrc yes --make-jobs 4
		```
	- :-1: 
		```
		cd /root/pkgsrc/devel/memcached
		bmake install clean
		```
	
- [**fss**](https://man.netbsd.org/fss.4)
	- **file system snapshot device**
	- Provides a **read-only interface** to the snapshot of a currently mounted file system.
	- **A snapshot is no filesystem versioning.**
	> You **cannot revert** the filesystem back to a snapshot without copying all the files on filesystem layer.
	> **You can only mount the snapshot to see what the filesystem looked like back then.**
	> [How-To](https://wiki.netbsd.org/tutorials/how_to_use_snapshots/)

#### Info after booting
- network
- ssh
- user
- File path
- `uname -mrs`
	```
	NetBSD 9.2 amd64
	```
- `du` at `/`
	```
	1166691 /
	```
	> 1.1 GB
- `sysctl -a | grep mem`
	![](https://i.imgur.com/EwDbihV.png)

## SMP
- Symmetric **Multiprocessing**

| BSD     | SMP                          |
|:------- | ---------------------------- |
| FreeBSD | Support                      |
| OpenBSD | Kernel were wrote for Single Processor  |
| NetBSD  | Support                      |

## Popularity
- ![](https://i.imgur.com/kHQTWSM.png)


## Reference
### Official
- [NetBSD Wiki](https://wiki.netbsd.org/)
	- [NetBSD doc](https://www.netbsd.org/docs/misc/index.html)
	- [NetDSD Manual Pages](https://man.netbsd.org/)
### Article
- [Wikipedia - Comparison of BSD operating systems](https://en.wikipedia.org/wiki/Comparison_of_BSD_operating_systems)
- [BSD家族大觀FreeBSD、OpenBSD、NetBSD](http://www.unixlinux.online/unixlinux/unixzs/gyunix/201702/23969.html)