Nearly every command on the system comes with a short reference document explaining the basic operation and its various flag arguments. FBSD calls the documentation on each command a manual. Each manual file is contained on the system as a compressed file. All the commands live in /usr/bin; you can list their names with the ls command.
The manuals are grouped by category. Some commands may be in two or more categories and have different documentation in its manual depending on what category it's in. The categories are:
1. General commands
2. System Calls
4. Special files
5. File Formats
7. Macros and conventions
8. Maintenance Commands
9. Kernel Interface
To explicitly access a manual by category for the pwd command you would enter man 1 pwd. Whoever thought this concept up must have been asleep at the wheel. How is any body to know in advance what category the command they are interested in belongs to? Just use this format of the command man xxx, where xxx is the command you are interested in. If you are not satisfied with the results you can use the online version of the man pages athttp://www.freebsd.org/cgi/man.cgi. There you can select what FBSD version of the commands to want to see as well as the categories. When I am researching a problem I always use the online man pages because, I can see what category it belongs to. If it also has related commands or the same command in a different category, it will show as a highlighted keyword that I can click on, and the online man system will jump right to it and display its info.
For example, to get info on the pwd command from your FBSD system, type in 'man pwd' on the command line and them hit enter on the keyboard. The manual page containing information on the pwd command is displayed. Use the arrow keys to scroll through the information. To exit the displayed man page info you can scroll to the end or press the ctrl key and the C key at the same time. PWD is a simple one, they do get much worse than this one. Over time you will begin to understand the shorthand the FBSD authors use to write these and it gets a little easier to understand. On the other hand some of the manuals are so poorly written they are just so much gibberish.
I will leave it up to you to decide how helpful the manual command documentation is.
The FBSD handbook does not include a list of the FBSD basic commands. There are a lot of books you can buy that have chapters that will explain Unix or Linux commands, and in most cases they are the same in FBSD. But I have found through experience that the number of FBSD commands you really need to know is very small and they are listed below. FBSD always considers upper case and lower case letters to be different. All commands are in lower case.
pwd Displays the directory path you are in
ls List the names of the files in the directory you are in
ls -l Same as ls except it also includes the file details
rm remove file (delete file) rm filename or rm /path/filename
cp copy file (cp source-file target-location)
rehash Search for new scripts and add them to the lookup order.
You have to issue this command every time you create a new
script and after installing most ports or packages.
lpr Print a file to the printer
halt Tell FBSD to close file systems and stop FBSD now
reboot Tell FBSD to close file systems and reboot now
shutdown Issue a message to logged on users that the system is coming down
and then closes file systems and stops FBSD
mkdir Make a new directory mkdir directory name
rmdir Remove directory rmdir directory name (delete directory)
cd Change into directory cd /etc/ppp/
cd / Change directory location back to root directory.
cd .. Change directory location back one sub-directory
ee Edit file ee /etc/rc.conf FBSD has a couple of editors,
but this editor is the easiest to use.
mount Mount a device like the floppy drive or the CDROM drive
umount Unmount a device, used to release a device after the mount command
ctrl + c Exit the shell right now.
ps ax Display a list of active tasks
chmod Change file permissions
chown Change the owner of the file
chgrp Change the group the file belongs to
pw Add users or delete user accounts
The /etc/syslog.conf file controls what system messages go to what log file. FBSD and most of the 3rd party applications that issue messages do so using facility.level.
Facility - This is who is issuing the messages. The common FBSD facilities are:
Kern. = messages issued from the kernel
Security. = messages issued from IPFW and IPF
Mail = messages issued from sendmail
lpr = messages issued from the printer system
local1 = messages issued from DHCP
Level - The level describes the severity of the message and is a keyword from
the following ordered list (higher to lower severity, from left to right):
emerg, alert, crit, err, warning, notice, info and debug.
There is a wildcard * meaning all or everything.
*.notice means messages from all facilities of level notice and below.
So that would include notice, info, and debug severity messages.
kern.=info means only kernel messages of severity level info are selected.
You have explicit control over the messages you can select to go to different logs. When you add a new log file for an application you just installed be sure to also configure it for rotation and archiving in /etc/newsyslog.conf.
As part of defining a new log file in /etc/syslog.conf you also have to create the file. Using the touch command will do this just fine. Example:
touch /var/log/dhcpd.log will create the dhcpd.log file.
To activate the changes to /etc/syslog.conf you can reboot or bump the syslog task into re-reading /etc/syslog.conf by kill –HUP pid. You get the pid (IE: process number) by listing the tasks with the ps ax command. Find syslog in the display, and the pid number is the number in the left column.
The /etc/newsyslog.conf file controls when a log is to be rotated and how it's to be archived. All of the standard logs defined in /etc/syslog.conf as part of the basic FBSD install are preconfigured in the /etc/newsyslog.conf.
The date command displays the current date and time read from the kernel clock. When used to set the date and time, both the kernel clock and the hardware clock are updated. Time changes for daylight saving time, standard time, leap seconds, and leap years are handled automatically.
Entering date on the command line followed by hitting enter will display the current date and time on your screen.
Use this format to set the date/time: date CCYYMMDDHHMM
CC Century (either 19 or 20)
YY Year in abbreviated form (e.g. 89 for 1989, 06 for 2006)
MM Numeric month, a number from 1 to 12
DD Day, a number from 1 to 31
HH Hour, a number from 0 to 23
MM Minutes, a number from 0 to 59
SS Seconds, a number from 0 to 59
sets the date and time to ``June 13, 2003, 4:27 PM''
Date 1157 will leave the date alone and just change the time to 11:57 AM.
After you get public Internet access you can use the operating system's ntpd daemon which sets and maintains the system time of day by synchronizing with Internet standard atomic clock time servers.
Sometimes you may want to capture everything that displays on the console screen to a file. This is really useful in making a record of what you are doing that you can review later if there is a problem. Use the script command like this:
When finished 'enter exit' to stop recording all console messages to the file.
Your FBSD system has a built in scheduling application called cron. This application has preconfigured system management reports scheduled daily, weekly, and monthly which are automatically generated by the cron application and emailed to the root account. As part of the boot process, cron is automatically started as a daemon. The schedules for these system management reports are in /etc/crontab. The scripts that actually generate the system management reports are in /etc/periodic/. Users can create their own reoccurring scheduled tasks using the crontab(1) command which places the users crontab schedule in /var/cron/tabs. Cron wakes up every minute, examining all stored crontabs, checking each command to see if it should be run in the current minute. When executing scheduled crontab commands, any output is mailed to the owner of the crontab (or to the user named in the MAILTO environment variable in the crontab, if such exists).
You will not see these system management reports if you power off your FBSD system before midnight every day. These reports are intended for productions systems that are up 24/7. The hostname= statement in rc.conf is used to determine the domain name the system management reports are emailed to,firstname.lastname@example.org.
This FreeBSD Installer Guide is an public domain HOW-TO. This content may be reproduced, in any form or by any means, and used by all without permission in writing from the author.