Last active
February 28, 2019 12:33
-
-
Save githubfoam/baf506dc5f89789d047ad638dbd5e226 to your computer and use it in GitHub Desktop.
freebsd cheat sheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ freebsd-version -k | |
| 11.1-RELEASE-p9 | |
| pkg update -y | |
| pkg upgrade -y | |
| pkg install -y wget bmake | |
| Display the network traffic going through active interfaces on the system. | |
| $ systat -ifstat | |
| The iostat utility displays kernel I/O statistics on terminal, device and cpu operations. | |
| $ iostat -xx 1 | |
| The vmstat utility reports certain kernel statistics kept about process, virtual memory, disk, trap and cpu activity. | |
| $ systat -vmstat 1 | |
| $ vmstat 1 | |
| # method1 | |
| svn checkout https://svn.freebsd.org/base/releng/`uname -r | cut -d'-' -f1,1` /usr/src | |
| # method2 | |
| fetch -o /tmp ftp://ftp.freebsd.org/pub/`uname -s`/releases/`uname -m`/`uname -r | cut -d'-' -f1,2`/src.txz | |
| #see all loaded modules | |
| kldstat | |
| #remove or unload module | |
| kldunload drm | |
| #load module | |
| kldload foo | |
| #compile and load modules | |
| cd /usr/src/sys/modules/module_name | |
| make | |
| kldload module_name.ko | |
| #VBox | |
| cd /usr/ports/emulators/virtualbox-ose-additions && make install clean | |
| #Build/Compile kernel | |
| sudo pkg install -y subversion | |
| svn info /usr/src | |
| sudo pkg install sqlite3 | |
| sudo svn checkout https://svn.freebsd.org/base/release/11.1.0/ /usr/src | |
| mv /usr/ports /usr/ports.bak | |
| sudo svn checkout https://svn.freebsd.org/ports/head /usr/ports | |
| #method1 | |
| sudo svn update /usr/ports | |
| sudo svn update /usr/src | |
| #method2 | |
| cd /usr/src | |
| make update SVN_UPDATE=yes | |
| #Building from Source | |
| cd /usr/src | |
| sudo make buildworld | |
| sudo make buildkernel | |
| sudo make cleanworld | |
| #Installing the Compiled Code | |
| cd /usr/src | |
| make installkernel | |
| shutdown -r now | |
| cd /usr/src | |
| make installworld | |
| shutdown -r now | |
| A checkout from a given repository is performed with a command like this: | |
| # svn checkout https://svn.FreeBSD.org/repository/branch lwcdir | |
| # svn checkout https://svn.FreeBSD.org/ports/head /usr/ports | |
| After the initial checkout, the local working copy can be updated by running | |
| # svn update lwcdir | |
| To update /usr/ports created in the example above, use: | |
| # svn update /usr/ports | |
| An alternate way of updating the local working copy after checkout is provided by the Makefile in the /usr/ports, /usr/src, and /usr/doc directories. | |
| Set SVN_UPDATE and use the update target. For example, to update /usr/src: | |
| # cd /usr/src | |
| # make update SVN_UPDATE=yes | |
| Install sudo using port, type: | |
| # cd /usr/ports/security/sudo/ && make install clean | |
| Install sudo as a binary package, enter: | |
| # pkg install security/sudo | |
| service netif restart | |
| # /etc/rc.d/netif restart && /etc/rc.d/routing restart | |
| /etc/netstart | |
| adduser alice | |
| rmuser alice |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment