FreeBSD - operating system
FreeBSD - operačný systém
The operating system for freedom
freebds hammer splash

Information website: FreeBSD

Various tips and scripts

A date cracking script

# This is a date cracking script for FreeBSD, (c) George Sipos, 1999
#!/bin/sh
# the following sets the variable "fname" which keeps the original date value

fname=`date "+ %y%m%d%H%M"`

# the following sets the old date, 99 is for 1999
# 10 is for month, 01 is for day, 1534 is time; change the date appropriately

date 9910011541

# include here the program to run, make sure the program is in your
# path, or type, for example, /usr/bin/joe

joe

# the following returns your original date; make sure you normally
# end the program with its CLOSE button when using X, otherwise
# your original date will not be switched back

date $fname
exit 0

A script to make ISO images

mkisofs -L -J -v -R -o /usr/cd.iso /disks

A script to change CAPITAL LETTERS to lower case

#!/bin/sh
for x in *; do
y=`echo $x | tr '[A-Z]' '[a-z]'`
if [ $x != $y ]; then
mv $x $y
fi
done

To format 1.44 MB diskettes for FreeBSD

fdformat -f 1440 fd0.1440
disklabel -w -r fd0.1440 floppy3
newfs -t 2 -u 18 -l 1 -i 65536 /dev/rfd0

How do I find IRQ's in my system?

vmstat -i

Free space on hard drives (MB's)

df -h

How do I start XDM on boot?

A: There are two schools of thought on how to start XDM. One school starts XDM from /etc/ttys using the supplied example, while the other one simply runs XDM from rc.local or from the X.sh script in /usr/local/etc/rc.d. Both are equally valid.

How to create a bootable floppy?

dd if=/dev/ad0 of=/dev/fd0 bs=512 count=1

It will copy your Master Boot Record onto the diskette and then you can boot from this diskette.

If you wish to run apps of other Unices, try brandelf

brandelf -t FreeBSD file

How do I find free memory?

dmesg | grep memory

What to do if I forget my password?

Run the single user mode at startup (boot) menu.

When FreeBSD loads, run:

mount -u /     (this will make your Read Only system writable; with the passwd command you can then change your password).

Use this table as an example for partitions (e.g., /dev/ad0s5 etc.)

for first disk                                                   for second disk

ad0s5 -- extended part. #1 (D:)                 ad1s5 -- extended part. #1

ad0s6 -- extended part. #2 (E:)                 ad1s6 -- extended part. #2

ad0s7 -- extended part. #3 (F:)                  ad1s7 -- extended part. #3

ad0s8 -- extended part. #4 (G:)                 ad1s8 -- extended part. #4

Partitions in FreeBSD

ad0s1a - / (root partition)

ad0s1b - swap

ad0s1e - /tmp

ad0s1f - /usr

ad0s1d - /var

How to make a BSD Fast File System for FreeBSD?

newfs -b 8192 1024 /dev/da0s1a

How to mount a CD?

mount -t cd9660 /dev/acd0c

How do I know if FreeBSD found my serial ports?

dmesg | grep sio sio2

sio2 (known as COM3 in DOS) is on /dev/cuaa2 for dial-out devices, and on /dev/ttyd2 for dial-in devices.

A Perl Script to setup ISDN4BSD on FreeBSD (simple dialout to ISP)

Unix is like Zen