Skip to content

Instantly share code, notes, and snippets.

@thomersch
Last active February 3, 2020 19:16
Show Gist options
  • Save thomersch/5840753 to your computer and use it in GitHub Desktop.
Save thomersch/5840753 to your computer and use it in GitHub Desktop.
Useful FreeBSD commands
* Installing software
* Set up ports collection
portsnap fetch && portsnap extract
* Updating ports collection
portsnap fetch && portsnap update
* Remove port
pkg_delete {}
* Upgrading with portupgrade
# set up
cd /usr/ports/ports-mgmt/portupgrade
make install clean
# perform upgrade of all packages
portupgrade -a
* List all hard drives
camcontrol devlist
* Spin down drives if idle
camcontrol standby <drive> -t <seconds>
* Get partition information
fdisk <device>
* Mount all partitions from /etc/fstab
mount -a
* Import ZFS pool (from old installation or other machine)
zpool import
zpool import -f <poolname>
* Activate NFS exports
echo 'nfs_server_enable="YES"' >> /etc/rc.conf
* Share ZFS pool via NFS
zfs share <poolname>
* Reload NFS exports
/etc/rc.d/mountd reload
* ZFS pool status
zpool status
* Show NFS exports
showmount -e
* Show system time/date
date
* Restart networking
/etc/rc.d/netif restart && /etc/rc.d/routing restart
* Check RAM for ECC
dmidecode -t memory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment