unix:freebsd:quick_tips
Differences
This shows you the differences between two versions of the page.
| — | unix:freebsd:quick_tips [2025/11/23 21:45] (current) – created - 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/ | ||
| + | |||
| + | ===== Hardware Devices ===== | ||
| + | |||
| + | ==== To locate all attached drives, scan dmesg.boot ==== | ||
| + | <code bash findDrives.sh> | ||
| + | #! /bin/sh | ||
| + | |||
| + | egrep ' | ||
| + | </ | ||
| + | |||
| + | Or, simply run | ||
| + | <code bash> | ||
| + | |||
| + | ==== List USB devices ==== | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | ==== Format a Drive ==== | ||
| + | |||
| + | Following example will set up an empty drive (/dev/da23) with GPT as the schema and one slice (partition). The partition will have a label, // | ||
| + | |||
| + | When you label a slice, it can be found in /dev/gpt/ and mounted using that alias. | ||
| + | |||
| + | <code bash> | ||
| + | # create the GPT schema | ||
| + | gpart create -s GPT da23 | ||
| + | # show what is there (nothing yet) | ||
| + | gpart list /dev/da23 | ||
| + | # add a new slice of type UFS, and give it a label, sneakernet | ||
| + | # use all of the available disk space for this (ie, only one slice) | ||
| + | gpart add -t freebsd-ufs -l sneakernet da23 | ||
| + | # show what is up | ||
| + | gpart list /dev/da23 | ||
| + | # format the partition with UFS | ||
| + | newfs /dev/da23p1 | ||
| + | # it should now show up as an alias in /dev/gpt | ||
| + | ls /dev/gpt | ||
| + | # make a place to mount it | ||
| + | mkdir / | ||
| + | # mount it | ||
| + | mount / | ||
| + | # unmount it | ||
| + | umount / | ||
| + | # clean up | ||
| + | rmdir / | ||
| + | </ | ||
| + | |||
| + | ===== Monitoring ===== | ||
| + | |||
| + | ==== CPU Temperatures ==== | ||
| + | |||
| + | Following command will show you the temperature of each core of a processor | ||
| + | <code bash> | ||
| + | |||
| + | ==== 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) | ||
| + | |||
| + | < | ||
| + | |||
| + | ==== watch substitute ==== | ||
| + | |||
| + | Under Linux, watch repeats a command over and over, so it is useful for monitoring long running processes. The FreeBSD command // | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | ===== Package Management ===== | ||
| + | ==== setting pkg to not ask permission ==== | ||
| + | |||
| + | I was used to Debian' | ||
| + | |||
| + | < | ||
| + | |||
| + | will install LWP (p5-libwww) without waiting for you to select " | ||
| + | |||
| + | ==== 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. | ||
| + | |||
| + | < | ||
| + | |||
| + | ===== 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 | ||
| + | |||
| + | < | ||
| + | |||
| + | where // | ||
| + | |||
| + | ==== 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. | ||
| + | |||
| + | < | ||
| + | |||
| + | Warning: do not modify the root account' | ||
| + | < | ||
| + | at the head of your scripts. | ||
| + | |||
| + | ===== zfs tricks ===== | ||
| + | * zfs unshare -a | ||
| + | * zfs share -a | ||
| + | * showmount -e | ||
| + | |||
unix/freebsd/quick_tips.1562834336.txt.gz · Last modified: (external edit)
