1 This fortune brought to you by:
4 Having trouble using FTP through a firewall? Try setting the environment
5 variable FTP_PASSIVE_MODE to yes, and see ftp(1) for more details.
7 By pressing "Scroll Lock" you can use the arrow keys to scroll backward
8 through the console output. Press "Scroll Lock" again to turn it off.
10 Want colour in your directory listings? Use "ls -G". "ls -F" is also useful,
11 and they can be combined as "ls -FG".
13 If you need to ask a question on the FreeBSD-questions mailing list then
15 http://www.freebsd.org/doc/en_US.ISO8859-1/articles/\
16 freebsd-questions/index.html
18 contains lots of useful advice to help you get the best results.
20 If you'd like to keep track of applications in the FreeBSD ports tree, take a
23 http://www.freshports.org/
25 To search for files that match a particular name, use find(1); for example
27 find / -name "*GENERIC*" -ls
29 will search '/', and all subdirectories, for files with 'GENERIC' in the name.
30 -- Stephen Hilton <nospam@hiltonbsd.com>
32 In tcsh, you can `set autolist' to have the shell automatically show
33 all the possible matches when doing filename/directory expansion.
34 -- Giorgos Keramidas <keramida@ceid.upatras.gr>
36 You can `set autologout = 30' to have tcsh log you off automatically
37 if you leave the shell idle for more than 30 seconds.
38 -- Giorgos Keramidas <keramida@ceid.upatras.gr>
40 If you `set filec' (file completion) in tcsh and write a part of the
41 filename, pressing TAB will show you the available choices when there
42 is more than one, or complete the filename if there's only one match.
43 -- Giorgos Keramidas <keramida@ceid.upatras.gr>
45 You can press up-arrow or down-arrow to walk through a list of
46 previous commands in tcsh.
47 -- Giorgos Keramidas <keramida@ceid.upatras.gr>
49 You can disable tcsh's terminal beep if you `set nobeep'.
50 -- Giorgos Keramidas <keramida@ceid.upatras.gr>
52 If you `set watch (0 any any)' in tcsh, you will be notified when
53 someone logs in or out of your system.
54 -- Giorgos Keramidas <keramida@ceid.upatras.gr>
56 Nice tcsh prompt: set prompt = '%m %# '
57 -- Giorgos Keramidas <keramida@ceid.upatras.gr>
59 Nice tcsh prompt: set prompt = '%n@%m%# '
60 -- Giorgos Keramidas <keramida@ceid.upatras.gr>
62 Nice tcsh prompt: set prompt = '%n@%m:%~%# '
63 -- Giorgos Keramidas <keramida@ceid.upatras.gr>
65 Nice tcsh prompt: set prompt = '%n@%m:%/%# '
66 -- Giorgos Keramidas <keramida@ceid.upatras.gr>
68 Nice tcsh prompt: set prompt = '[%B%m%b] %B%~%b%# '
70 Simple tcsh prompt: set prompt = '%# '
71 -- Giorgos Keramidas <keramida@ceid.upatras.gr>
73 If you want df(1) and other commands to display disk sizes in
74 kilobytes instead of 512-byte blocks, set BLOCKSIZE in your
76 -- Giorgos Keramidas <keramida@ceid.upatras.gr>
78 To change an environment variable in tcsh you use: setenv NAME "value"
79 where NAME is the name of the variable and "value" its new value.
80 -- Giorgos Keramidas <keramida@ceid.upatras.gr>
82 To change an environment variable in /bin/sh use:
86 -- Giorgos Keramidas <keramida@ceid.upatras.gr>
88 /etc/make.conf contains overrides to /etc/defaults/make.conf, which
89 controls the options used to compile software on this system.
91 To do a fast search for a file, try
95 locate uses a database that is updated every saturday (assuming your computer
96 is running FreeBSD at the time) to quickly find files based on name only.
98 In order to search for a string in some files, use 'grep' like this:
100 grep "string" filename1 [filename2 filename3 ...]
102 This will print out the lines in the files that contain the string. grep can
103 also do a lot more advanced searches - type 'man grep' for details.
105 You can use the 'fetch' command to retrieve files over ftp or http.
107 fetch http://www.freebsd.org/index.html
109 will download the front page of the FreeBSD web site.
111 In order to make fetch (the FreeBSD downloading tool) ask for
112 username/password when it encounter a password-protected web page, you can set
113 the environment variable HTTP_AUTH to 'basic:*'.
115 You can permanently set environment variables for your shell by putting them
116 in a startup file for the shell. The name of the startup file varies
117 depending on the shell - csh and tcsh uses .cshrc, bash uses .bashrc, zsh uses
118 .zshenv, ksh uses .kshrc, and the Bourne shell (/bin/sh) uses .profile (and
119 through a little bit of trickery in .profile also .shrc)
120 Other shells will often also read .profile
122 If you are running xterm, the default TERM variable will be 'xterm'. If you
123 set this environment variable to 'xterm-color' instead, a lot of programs will
124 use colors. You can do this by
126 TERM=xterm-color; export TERM
128 in Bourne-derived shells, and
130 setenv TERM xterm-color
132 in csh-derived shells.
134 If you accidently drop into /bin/sh (e.g, due to a computer failure where you
135 end up in single user mode), you can make the cursor keys work by typing
139 The E represents the initial E in Emacs (for emacs keys).
141 If you do not want to get beeps in X11 (X Windows), you can turn them off with
145 You can look through a file in a nice text-based interface by typing
149 The default editor in FreeBSD is vi, which is efficient to use when you have
150 learned it, but somewhat user-unfriendly. To use ee (an easier but less
151 powerful editor) instead, set the environment variable EDITOR to /usr/bin/ee
153 If you accidently end up inside vi, you can quit it by pressing Escape, colon
154 (:), q (q), bang (!) and pressing return.
156 You can use aliases to decrease the amount of typing you need to do to get
157 commands you commonly use. Examples of fairly popular aliases include (in
158 bourne shell style, as in /bin/sh, bash, ksh, and zsh):
164 In csh or tcsh, these would be
170 To remove an alias, you can usually use 'unalias aliasname'. To list all
171 aliases, you can usually type just 'alias'.
173 In order to support national characters for european languages in tools like
174 less without creating other nationalisation aspects, set the environment
175 variable LC_ALL to 'en_US.ISO8859-1'.
177 You can search for documentation on a keyword by typing
181 Man pages are divided into section depending on topic. There are 9 different
182 sections numbered from 1 (General Commands) to 9 (Kernel Developer's Manual).
183 You can get an introduction to each topic by typing
187 In other words, to get the intro to general commands, type
191 FreeBSD is started up by the program 'init'. The first thing init does when
192 starting multiuser mode (ie, starting the computer up for normal use) is to
193 run the shell script /etc/rc. By reading /etc/rc, you can learn a lot about
194 how the system is put together, which again will make you more confident about
195 what happens when you do something with it.
197 If you want to play CDs with FreeBSD, a utility for this is already included.
198 Type 'cdcontrol' then 'help' to learn more. (You may need to set the CDROM
199 environment variable in order to make cdcontrol want to start.)
201 If you have a CD-ROM drive in your machine, you can make the CD-ROM that is
202 presently inserted available by typing 'mount /cdrom' as root. The CD-ROM
203 will be available under /cdrom/. Remember to do 'unmount /cdrom' before
204 removing the CD-ROM (it will usually not be possible to remove the CD-ROM
207 Note: This tip may not work in all configurations.
209 You can install extra packages for FreeBSD by using the ports system.
210 If you have installed it, you can download, compile, and install software by
213 # cd /usr/ports/<category>/<portname>
214 # make install && make clean
216 as root. The ports infrastructure will download the software, change it so
217 it works on FreeBSD, compile it, install it, register the installation so it
218 will be possible to automatically uninstall it, and clean out the temporary
219 working space it used. You can remove an installed port you decide you do not
220 want after all by typing
222 # cd /usr/ports/<category>/<portname>
227 Nice bash prompt: PS1='(\[$(tput md)\]\t <\w>\[$(tput me)\]) $(echo $?) \$ '
228 -- Mathieu <mathieu@hal.interactionvirtuelle.com>
230 To see the output from when your computer started, run dmesg(8). If it has
231 been replaced with other messages, look at /var/run/dmesg.boot.
232 -- Francisco Reyes <lists@natserv.com>
234 You can use "whereis" to locate standard binary, manual page and source
235 directories for the specified programs. This can be particularly handy
236 when you are trying to find where in the ports tree an application is.
238 Try "whereis netscape" and "whereis whereis".
239 -- Konstantinos Konstantinidis <kkonstan@duth.gr>
241 You can press Ctrl-D to quickly exit from a shell, or logout from a
243 -- Konstantinos Konstantinidis <kkonstan@duth.gr>
245 You can use "pkg_info" to see a list of packages you have installed.
246 -- Konstantinos Konstantinidis <kkonstan@duth.gr>
248 You can change the video mode on all consoles by adding something like
249 the following to /etc/rc.conf:
253 You can use "vidcontrol -i mode | grep T" for a list of supported text
255 -- Konstantinos Konstantinidis <kkonstan@duth.gr>
257 Any user that is a member of the wheel group can use "su -" to simulate
258 a root login. You can add a user to the wheel group by editing /etc/group.
259 -- -- Konstantinos Konstantinidis <kkonstan@duth.gr>
261 Over quota? "du -s * | sort -n " will give you a sorted list of your
263 -- David Scheidt <dscheidt@tumbolia.com>
265 Handy bash(1) prompt: PS1="\u@\h \w \!$ "
266 -- David Scheidt <dscheidt@tumbolia.com>
268 man -k "something" will give you a list of manpages that have "something"
269 in their description.
270 -- David Scheidt <dscheidt@tumbolia.com>
272 Ever wonder what those numbers after command names were, as in cat(1)? It's
273 the section of the manual the man page is in. "man man" will tell you more.
274 -- David Scheidt <dscheidt@tumbolia.com>
276 "man hier" will explain the way FreeBSD filesystems are normally laid out.
277 -- David Scheidt <dscheidt@tumbolia.com>
279 "man tuning" gives some tips how to tune performance of your FreeBSD system.
280 -- David Scheidt <dscheidt@tumbolia.com>
282 "man firewall" will give advice for building a FreeBSD firewall
283 -- David Scheidt <dscheidt@tumbolia.com>
285 You can often get answers to your questions about FreeBSD by searching in the
286 FreeBSD mailing list archives at
288 http://www.freebsd.org/search.html
290 You can adjust the volume of various parts of the sound system in your
291 computer by typing 'mixer <type> <volume>'. To get a list of what you can
292 adjust, just type 'mixer'.
294 You can automatically download and install binary packages by doing
298 where you replace <URL> with the URL to the package. This will also
299 automatically install the packages the package you download is dependent on
300 (ie, the packages it needs in order to work.)
302 You can get a good standard workstation install by using the
303 instant-workstation port/package. If you have ports installed, you can
306 # cd /usr/ports/misc/instant-workstation
307 # make install && make clean
309 as root. This will install a collection of packages that is convenient to
310 have on a workstation.
312 You can get a good generic server install by using the
313 instant-server port/package. If you have ports installed, you can
316 # cd /usr/ports/misc/instant-server
317 # make install && make clean
319 as root. This will install a collection of packages that is appropriate for
320 running a "generic" server.
322 You can make a log of you terminal session with script(1).
324 "man ports" gives many useful hints about installing FreeBSD ports.
326 ports/net/netcat port is useful not only for redirecting input/output
327 to TCP or UDP connections, but also for proxying them. See inetd(8) for
330 If other operating systems have damaged your Master Boot Record, you can
331 reinstall it either with /stand/sysinstall or with boot0cfg(8). See
332 "man boot0cfg" for details.
334 Need to see the calendar for this month? Simply type "cal". To see the
335 whole year, type "cal 2001".
336 -- Dru <genesis@istar.ca>
338 Need to quickly return to your home directory? Type "cd".
339 -- Dru <genesis@istar.ca>
341 To see the last time that you logged in, use lastlogin(8).
342 -- Dru <genesis@istar.ca>
344 To clear the screen, use "clear". To re-display your screen buffer, press
345 the scroll lock key and use your page up button. When you're finished,
346 press the scroll lock key again to get your prompt back.
347 -- Dru <genesis@istar.ca>
349 To save disk space in your home directory, can compress files you
350 rarely use with "gzip filename".
351 -- Dru <genesis@istar.ca>
353 To read a compressed file without having to first uncompress it, use
354 "zcat" or "zmore" to view it.
355 -- Dru <genesis@istar.ca>
357 To see how much disk space is left on your partitions, use
360 -- Dru <genesis@istar.ca>
362 To see the 10 largest files on a directory or partition, use
364 du /partition_or_directory_name | sort -rn | head
365 -- Dru <genesis@istar.ca>
367 To determine whether a file is a text file, executable, or some other type
371 -- Dru <genesis@istar.ca>
373 Need to find the information that was displayed on your screen at boot
376 more /var/run/dmesg.boot
377 -- Dru <genesis@istar.ca>
379 Time to change your password? Type "passwd" and follow the prompts.
380 -- Dru <genesis@istar.ca>
382 Want to know how many words, lines, or bytes are contained in a file? Type
384 -- Dru <genesis@istar.ca>
386 Need to print a manpage? Use
388 man name_of_manpage | col -bx | lpr
389 -- Dru <genesis@istar.ca>
391 Need to remove all those ^M characters from a DOS file? Try
393 col -bx < dosfile > newfile
394 -- Dru <genesis@istar.ca>
396 Forget what directory you are in? Type "pwd".
397 -- Dru <genesis@istar.ca>
399 If you are in the C shell and have just installed a new program, you won't
400 be able to run it unless you first type "rehash".
401 -- Dru <genesis@istar.ca>
403 Need to leave your terminal for a few minutes and don't want to logout?
404 Use "lock -p". When you return, use your password as the key to unlock the
406 -- Dru <genesis@istar.ca>
408 Want to save your login session to a file? Type "script filename" to
409 record your session. When you are finished, hold down the control key and
411 -- Dru <genesis@istar.ca>
413 Need to find the location of a program? Use "locate -b program_name".
414 -- Dru <genesis@istar.ca>
416 Forget how to spell a word or a variation of a word? Use
418 look portion_of_word_you_know
419 -- Dru <genesis@istar.ca>
421 To see the last 10 lines of a long file, use "tail filename". To see the
422 first 10 lines, use "head filename".
423 -- Dru <genesis@istar.ca>
425 To see how long it takes a command to run, type the word "time" before the
427 -- Dru <genesis@istar.ca>
429 To quickly create an empty file, use "touch filename".
430 -- Dru <genesis@istar.ca>
432 To find out the hostname associated with an IP address, use
435 -- Dru <genesis@istar.ca>
437 If you use the C shell, add the following line to the .cshrc file in your
438 home directory to prevent core files from being written to disk:
441 -- Dru <genesis@istar.ca>
443 If you need a reminder to leave your terminal, type "leave hhmm" where
444 "hhmm" represents in how many hours and minutes you need to leave.
445 -- Dru <genesis@istar.ca>
447 Need to do a search in a manpage or in a file you've sent to a pager? Use
448 "/search_word". To repeat the same search, type "n" for next.
449 -- Dru <genesis@istar.ca>
451 Forget when Easter is? Try "ncal -e". If you need the date for Orthodox
452 Easter, use "ncal -o" instead.
453 -- Dru <genesis@istar.ca>
455 Need to see your routing table? Type "netstat -rn". The entry with the G
456 flag is your gateway.
457 -- Dru <genesis@istar.ca>
459 Need to see which daemons are listening for connection requests? Use
461 -- Dru <genesis@istar.ca>
463 Can't remember is you've installed a certain port or not? Try "pkg_info |
465 -- Dru <genesis@istar.ca>
467 Got some time to kill? Try typing "hangman".
468 -- Dru <genesis@istar.ca>
470 To erase a line you've written at the command prompt, use "Ctrl u".
471 -- Dru <genesis@istar.ca>
473 To repeat the last command in the C shell, type "!!".
474 -- Dru <genesis@istar.ca>
476 Need to quickly empty a file? Use "echo > filename".
477 -- Dru <genesis@istar.ca>
479 To see all of the directories on your FreeBSD system, type
482 -- Dru <genesis@istar.ca>
484 To see the IP addresses currently set on your active interfaces, type
486 -- Dru <genesis@istar.ca>
488 To see the MAC addresses of the NICs on your system, type
490 grep address /var/run/dmesg.boot
491 -- Dru <genesis@istar.ca>