User Tools

Site Tools


unix:freebsd:quick_tips

Differences

This shows you the differences between two versions of the page.


Next revision
unix:freebsd:quick_tips [2019/07/11 03:38] – external edit 127.0.0.1
Line 1: Line 1:
 +====== Quick FreeBSD Tricks ======
 +
 +In several places, I have simply inserted the code as a script to be downloaded. I tend to keep things like this around so I can just run a simple command instead of copying/pasting an entire line.
 +
 +===== Hardware Devices =====
 +
 +==== To locate all attached drives, scan dmesg.boot ====
 +<code bash findDrives.sh>
 +#! /bin/sh
 +
 +egrep '(ad|cd|da)[0-9]' /var/run/dmesg.boot | sort
 +</code>
 +
 +===== Monitoring =====
 +==== iotop substitute ====
 +
 +iotop is a well known utility under Linux, but not available for FreeBSD. However, the following command will do the same thing (does not apparently work for iSCSI devices)
 +
 +<code>top -m io -o total</code>
 +
 +===== Package Management =====
 +==== setting pkg to not ask permission ====
 +
 +I was used to Debian's apt-get, and used the -y (answer "Yes" to all questions) parameter. Looking for something similar for pkg, I ran across [[http://dan.langille.org/2013/12/06/bootstrapping-installing-pkg-on-freebsd-unattended-and-without-answering-yes/]] which showed a possible answer; set an environmental variable as part of the call.
 +
 +<code>env ASSUME_ALWAYS_YES=YES pkg install p5-libwww</code>
 +
 +will install LWP (p5-libwww) without waiting for you to select "Yes"
 +
 +==== clean pkg cache ====
 +
 +After a while, your pkg cache will use more and more space on your disk, with copies of packages you have already installed. The following command cleans that cache.
 +
 +<code>pkg clean</code>
 +
 +===== User Administration =====
 +==== Administrative Permission ====
 +By default, a new user is **not** able to become root. To do this, you must add them to the //wheel// group. Use the following command
 +
 +<code>pw user  mod  username -G wheel</code>
 +
 +where //username// is the username of the user who has access
 +
 +==== Changing Shell ====
 +
 +I just like //bash// for my shell. While it is not the standard for BSD, it is much more powerful than the standard //sh//, so I like to use it for my personal account. Once bash is installed, set it as the default shell for a user.
 +
 +<code>chsh -s bash username</code>
 +
 +Warning: do not modify the root account's shell. You will break your system. If you want a bash script to run as root, be sure to include
 +<code>#! /usr/bin/env bash</code>
 +at the head of your scripts.
 +
 +===== zfs tricks =====
 +  * zfs unshare -a
 +  * zfs share -a
 +  * showmount -e
 +
  
unix/freebsd/quick_tips.txt · Last modified: 2023/11/23 01:03 by rodolico