1
0
Files
Command_Line_Cheat_Sheet/FreeBSD.md
2023-12-01 18:55:25 +01:00

1.2 KiB

FreeBSD Cheat Sheet

A collection of commands I use frequently and still don't remember.

pkg

Display the message after first installing the application

pkg show -D <pkg_name>

iocage

Setup a new jail with vnet

iocage create -n <jailname> ip4_addr="10.192.0.28/24" defaultrouter="10.192.0.1" allow_raw_sockets=1 vnet=on boot=on interfaces="vnet0:em0bridge" -r 13.2-RELEASE

zfs

Show holds on a specific snapshot

If snapshots return as dataset is busy upon deletion, they are either dependent or use a tag that prevents them from being deleted. The command below will display any holds on a snapshot.

zfs holds -r <snapshot_name>

To release the snapshot from a tag

zfs release -r <tag_name> <snapshot_name>

Migrate dataset to new pool

zfs snapshot -r old_pool/<dataset_name>@relocate
zfs send -Rv old_pool/<dataset_name>@relocate | zfs receive -d new_pool/<new_dataset_name>

tcsh

Execute command from history

history | grep <command>
!<id command>

For loop to copy files and rename in destination

foreach f (*.jpg)
cp "$f" /destination/newname-"$f"
end

Use quotes if filenames have spaces