Jump to content
  • Create New...

FreeBSD - Sysadmin cheatsheet

Recommended Posts

  • Premium

Hi guys,
I would like to collect here some useful commands to perform basic actions on our FreeBSD servers. You are invited to contributed your own, I just want to get the ball rolling.
We are assuming that you run a supported FreeBSD system (at the time of writing this, 8.4, 9.2 and 10.0) and are connected to the Internet. How this is done is covered elsewhere in this forum.
See your system clock


Sync your system clock

ntpdate pool.ntp.org

Change your server's timezone
The available timezones are found in /usr/share/zoneinfo. Copy the desired timezone to /etc/localtime. Example:

cp /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime

Will set your server timezone to CET. This does NOT change the server time; you have to do this yourself.
Find a file in the system
Build the locate database:



locate filename

Install the most recent updates for your system

freebsd-update fetch install

Upgrade to a newer version

freebsd-update -r release

Where release is the name on the release, ex: 9.2-RELEASE. Follow the instructions on screen (When asked if "this does look reasonable", just press y and enter unless you know what you are doing)
View the contents of a file

cat filename

Edit a text file

ee filename

Download a file

fetch <url>

Show what is being written to a log in real time:

tail -f <filename>

Delete a file

rm <filename>

Delete a directory with all its content 

rm -R <foldername>

Extract a tar.gz archive

tar xzvf <filename>

Create a tar.gz archive

tar czvf <destination filename> <file or folder to archive>


tar czvf /root/mysql.tgz /var/db/mysql

Transfer a file from a server to another

scp <filename> <user>@<host>:<path>


scp mysql.tgz [email protected]:/root/mysql.tgz

Reboot the system


Shut down the system


(If this is a remote server, make sure your hosting package allows you to start it later on!)
Install 32 bit libraries on a 64 bit system

cd /tmp
fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/9.2-RELEASE/lib32.txz
tar xfp lib32.txz -C /

(Replace 9.2-RELEASE in the URL with your version as needed)

  • Love 5



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.