OpenBSD Tricks
Aliases
to paste into your bashrc
mf ="mount -t msdos /dev/fd0Ba /floppy" # This will
mount a MSDOS formatted diskette
mcd="mount /dev/cd0a /cdrom" # Mount CDROM Drive
musb="mount /dev/sd0i /thumb
netstat
-I sis0 -w 5
This gives the network I/O status of a netgear card interface (-I)
(sis0) every 5 seconds (-w)
ps -aux
(Process Started listing)
Setup
tricks
etc/sysctrl.conf
file
make sure the ddb.panic = 0 # Set a machine's default to
reboot after a kernel panic
net.inet.ip.forwarding =1 # set ip forwarding on for bridging and
packet filtering
/etc/rc.conf.local - Turn on the Packet Filter program if
you have set it up
pf = yes
stopping
pf
pfctl -d
starting pf
pfctl -e
starting pf with configuration file
pfctl -f /etc/pf.conf
More
PF commands
#
pfctl -f /etc/pf.conf Load the pf.conf file
# pfctl -nf /etc/pf.conf Parse the file, but don't load it
# pfctl -Nf /etc/pf.conf Load only the NAT rules from the file
# pfctl -Rf /etc/pf.conf Load only the filter rules from the file
# pfctl -sn Show the current NAT rules
# pfctl -sr Show the current filter rules
# pfctl -ss Show the current state table
# pfctl -si Show filter stats and counters
# pfctl -sa Show EVERYTHING it can show
Mount
a floppy disk
mkdir /floppy #The first time you
mount a floppy disk you need to create a mount point:
ls /dev/fd* # to
find a floppy device
mount -t msdos /dev/fd0Ba /floppy #
This will mount a MSDOS formatted diskette
cd /floppy # Change
into the floppy directory
cd / #
Change to the root directory so the diskette can be unmounted
umount /floppy #
unmount the floppy diskette
tar -zxvf bash*.tgz /
will untar a comppressed tarball into the current directory
Mount
a CD-ROM (at /cdrom mount point)
after creating the a mount point (i.e.mkdir /cdrom)
mount /dev/cd0a /cdrom
Disk
Usage
df usage of major partitions
du -s size of current directory
ls -la full info. file listing incl. hidden files
ls -laF full info. file listing incl. hidden files & file types
#where @ is link, * executable, / is directory
ls -ld full info. directory listing
ls -laF | sort | grep "/" #list all directories
ls -laF | sort | grep "*" #list all executables
Data
and File tricks
sed
's/^0/string/g' file-in.txt>file-out.txt
globally replaces zero at the beggining of the line with
string and write the output to file-out.txt - don't forget the quotation
marks.
Add
a partition or hard drive to system
# disklabel -E wd0
# vi /etc/fstab
# newfs /dev/wd0d