freebsd-tips revision 163144
178266SnikThis fortune brought to you by:
278266Snik$FreeBSD: head/games/fortune/datfiles/freebsd-tips 163144 2006-10-09 04:11:34Z chinsan $
378266Snik%
488035SmikehHaving trouble using fetch through a firewall? Try setting the environment
588035Smikehvariable FTP_PASSIVE_MODE to yes, and see fetch(3) for more details.
678266Snik%
778266SnikBy pressing "Scroll Lock" you can use the arrow keys to scroll backward
878266Snikthrough the console output.  Press "Scroll Lock" again to turn it off.
978266Snik%
1078266SnikWant colour in your directory listings?  Use "ls -G".  "ls -F" is also useful,
1178266Snikand they can be combined as "ls -FG".
1278266Snik%
1378266SnikIf you need to ask a question on the FreeBSD-questions mailing list then
1478266Snik
1578266Snik	http://www.freebsd.org/doc/en_US.ISO8859-1/articles/\
1678266Snik		freebsd-questions/index.html
1778266Snik
1878266Snikcontains lots of useful advice to help you get the best results.
1978266Snik%
2078266SnikIf you'd like to keep track of applications in the FreeBSD ports tree, take a
2178266Sniklook at FreshPorts;
2278266Snik
2378266Snik	http://www.freshports.org/
2478266Snik%
2578266SnikTo search for files that match a particular name, use find(1); for example
2678266Snik
2778266Snik	find / -name "*GENERIC*" -ls
2878266Snik
2978266Snikwill search '/', and all subdirectories, for files with 'GENERIC' in the name.
3078266Snik      	--  Stephen Hilton <nospam@hiltonbsd.com>
3178266Snik%
3278266SnikIn tcsh, you can `set autolist' to have the shell automatically show
3378266Snikall the possible matches when doing filename/directory expansion.
3478266Snik%
3578266SnikYou can `set autologout = 30' to have tcsh log you off automatically
3684001Smurrayif you leave the shell idle for more than 30 minutes.
3778266Snik%
3878266SnikIf you `set filec' (file completion) in tcsh and write a part of the
3978266Snikfilename, pressing TAB will show you the available choices when there
4078266Snikis more than one, or complete the filename if there's only one match.
4178266Snik%
4278266SnikYou can press up-arrow or down-arrow to walk through a list of
4378266Snikprevious commands in tcsh.
4478266Snik%
4578266SnikYou can disable tcsh's terminal beep if you `set nobeep'.
4678266Snik%
47106986SjoergIf you `set watch = (0 any any)' in tcsh, you will be notified when
4878266Sniksomeone logs in or out of your system.
4978266Snik%
5078266SnikNice tcsh prompt: set prompt = '%m %# '
5178266Snik%
5278266SnikNice tcsh prompt: set prompt = '%n@%m%# '
5378266Snik%
5478266SnikNice tcsh prompt: set prompt = '%n@%m:%~%# '
5578266Snik%
5678266SnikNice tcsh prompt: set prompt = '%n@%m:%/%# '
5778266Snik%
5878266SnikNice tcsh prompt: set prompt = '[%B%m%b] %B%~%b%# '
5978266Snik%
6078266SnikSimple tcsh prompt: set prompt = '%# '
6178266Snik%
6278266SnikIf you want df(1) and other commands to display disk sizes in
6378266Snikkilobytes instead of 512-byte blocks, set BLOCKSIZE in your
6495677Sdougbenvironment to 'K'.  You can also use 'M' for Megabytes or 'G' for
6593516SjoeGigabytes.  If you want df(1) to automatically select the best size
6693516Sjoethen use 'df -h'.
6778266Snik%
6878266SnikTo change an environment variable in tcsh you use: setenv NAME "value"
6978266Snikwhere NAME is the name of the variable and "value" its new value.
7078266Snik%
7178266SnikTo change an environment variable in /bin/sh use:
7278266Snik
7378266Snik	$ VARIABLE="value"
7478266Snik	$ export VARIABLE
7578266Snik%
7682604SalexYou can use /etc/make.conf to control the options used to compile software
77105482Sblackendon this system.  Example entries are in
78148797Skrion/usr/share/examples/etc/make.conf.
7978266Snik%
8078266SnikTo do a fast search for a file, try
8178266Snik
8278266Snik	 locate filename
8378266Snik
8479027Smpplocate uses a database that is updated every Saturday (assuming your computer
8578266Snikis running FreeBSD at the time) to quickly find files based on name only.
8678266Snik%
8778266SnikIn order to search for a string in some files, use 'grep' like this:
8878266Snik
8978266Snik	 grep "string" filename1 [filename2 filename3 ...]
9078266Snik
9178266SnikThis will print out the lines in the files that contain the string.  grep can
9278266Snikalso do a lot more advanced searches - type 'man grep' for details.
9378266Snik%
9478266SnikYou can use the 'fetch' command to retrieve files over ftp or http.
9578266Snik
9678266Snik	 fetch http://www.freebsd.org/index.html
9778266Snik
9878266Snikwill download the front page of the FreeBSD web site.
9978266Snik%
10078266SnikIn order to make fetch (the FreeBSD downloading tool) ask for
101143833Smurrayusername/password when it encounters a password-protected web page, you can set
10278266Snikthe environment variable HTTP_AUTH to 'basic:*'.
10378266Snik%
10478266SnikYou can permanently set environment variables for your shell by putting them
10578266Snikin a startup file for the shell.  The name of the startup file varies
10678772Sbriandepending on the shell - csh and tcsh uses .login, bash, sh, ksh and zsh use
10778772Sbrian.profile.  When using bash, sh, ksh or zsh, don't forget to export the
10878772Sbrianvariable.
10978266Snik%
11078266SnikIf you are running xterm, the default TERM variable will be 'xterm'.  If you
11178266Snikset this environment variable to 'xterm-color' instead, a lot of programs will
11278266Snikuse colors.  You can do this by
11378266Snik
11478266Snik	TERM=xterm-color; export TERM
11578266Snik
11678266Snikin Bourne-derived shells, and
11778266Snik
11878266Snik	setenv TERM xterm-color
11978266Snik
12078266Snikin csh-derived shells.
12178266Snik%
12278266SnikIf you do not want to get beeps in X11 (X Windows), you can turn them off with
12378266Snik
12478266Snik	xset b off
12578266Snik%
12678266SnikYou can look through a file in a nice text-based interface by typing
12778266Snik
12878266Snik	less filename
12978266Snik%
13078266SnikThe default editor in FreeBSD is vi, which is efficient to use when you have
13178266Sniklearned it, but somewhat user-unfriendly.  To use ee (an easier but less
13278266Snikpowerful editor) instead, set the environment variable EDITOR to /usr/bin/ee
13378266Snik%
134125955ScpercivaIf you accidentally end up inside vi, you can quit it by pressing Escape, colon 
13578266Snik(:), q (q), bang (!) and pressing return.
13678266Snik%
13778266SnikYou can use aliases to decrease the amount of typing you need to do to get
13878266Snikcommands you commonly use.  Examples of fairly popular aliases include (in
139125955ScpercivaBourne shell style, as in /bin/sh, bash, ksh, and zsh):
14078266Snik
14178266Snik	alias lf="ls -FA"
14278266Snik	alias ll="ls -lA"
14378266Snik	alias su="su -m"
14478266Snik
14578266SnikIn csh or tcsh, these would be
14678266Snik
14778266Snik	alias lf ls -FA
14878266Snik	alias ll ls -lA
14978266Snik	alias su su -m
15078266Snik
15178266SnikTo remove an alias, you can usually use 'unalias aliasname'.  To list all
15278266Snikaliases, you can usually type just 'alias'.
15378266Snik%
154125955ScpercivaIn order to support national characters for European languages in tools like
15578266Snikless without creating other nationalisation aspects, set the environment
15678266Snikvariable LC_ALL to 'en_US.ISO8859-1'.
15778266Snik%
15878266SnikYou can search for documentation on a keyword by typing
15978266Snik
16078266Snik	apropos keyword
16178266Snik%
16278266SnikMan pages are divided into section depending on topic.  There are 9 different
16378266Sniksections numbered from 1 (General Commands) to 9 (Kernel Developer's Manual).
16478266SnikYou can get an introduction to each topic by typing
16578266Snik
16678266Snik	man <number> intro
16778266Snik
16878266SnikIn other words, to get the intro to general commands, type
16978266Snik
17078266Snik	man 1 intro
17178266Snik%
17278266SnikFreeBSD is started up by the program 'init'.  The first thing init does when
17378266Snikstarting multiuser mode (ie, starting the computer up for normal use) is to
174148797Skrionrun the shell script /etc/rc.  By reading /etc/rc and the /etc/rc.d/ scripts,
175148797Skrionyou can learn a lot about how the system is put together, which again will
176148797Skrionmake you more confident about what happens when you do something with it.
17778266Snik%
17878266SnikIf you want to play CDs with FreeBSD, a utility for this is already included.
17978266SnikType 'cdcontrol' then 'help' to learn more.  (You may need to set the CDROM
18078266Snikenvironment variable in order to make cdcontrol want to start.)
18178266Snik%
18278266SnikIf you have a CD-ROM drive in your machine, you can make the CD-ROM that is
18378266Snikpresently inserted available by typing 'mount /cdrom' as root.   The CD-ROM
18478512Smphwill be available under /cdrom/.  Remember to do 'umount /cdrom' before
18578266Snikremoving the CD-ROM (it will usually not be possible to remove the CD-ROM
18678266Snikwithout doing this.)
18778266Snik
18878266SnikNote: This tip may not work in all configurations.
18978266Snik%
19078266SnikYou can install extra packages for FreeBSD by using the ports system.
19178266SnikIf you have installed it, you can download, compile, and install software by
19278266Snikjust typing
19378266Snik
19478266Snik	# cd /usr/ports/<category>/<portname>
19578266Snik	# make install && make clean
19678266Snik
19778266Snikas root.   The ports infrastructure will download the software, change it so
19878266Snikit works on FreeBSD, compile it, install it, register the installation so it
19978266Snikwill be possible to automatically uninstall it, and clean out the temporary
20078266Snikworking space it used.  You can remove an installed port you decide you do not
20178266Snikwant after all by typing
20278266Snik
20378266Snik	# cd /usr/ports/<category>/<portname>
20478266Snik	# make deinstall
20578266Snik
20678266Snikas root.
20778266Snik%
20878266SnikNice bash prompt: PS1='(\[$(tput md)\]\t <\w>\[$(tput me)\]) $(echo $?) \$ '
20978266Snik		-- Mathieu <mathieu@hal.interactionvirtuelle.com>
21078266Snik%
21178266SnikTo see the output from when your computer started, run dmesg(8).  If it has
21278266Snikbeen replaced with other messages, look at /var/run/dmesg.boot.
21378266Snik		-- Francisco Reyes <lists@natserv.com>
21478266Snik%
215148797SkrionYou can use "whereis" to search standard binary, manual page and source
21678266Snikdirectories for the specified programs. This can be particularly handy
21778266Snikwhen you are trying to find where in the ports tree an application is.
21878266Snik
21978266SnikTry "whereis netscape" and "whereis whereis".
22078266Snik		-- Konstantinos Konstantinidis <kkonstan@duth.gr>
22178266Snik%
22278266SnikYou can press Ctrl-D to quickly exit from a shell, or logout from a
22378266Sniklogin shell.
22478266Snik		-- Konstantinos Konstantinidis <kkonstan@duth.gr>
22578266Snik%
22678266SnikYou can use "pkg_info" to see a list of packages you have installed.
22778266Snik		-- Konstantinos Konstantinidis <kkonstan@duth.gr>
22878266Snik%
22978266SnikYou can change the video mode on all consoles by adding something like
23078266Snikthe following to /etc/rc.conf:
23178266Snik
23278266Snik	allscreens="80x30"
23378266Snik
23478266SnikYou can use "vidcontrol -i mode | grep T" for a list of supported text
23578266Snikmodes.
23678266Snik		-- Konstantinos Konstantinidis <kkonstan@duth.gr>
23778266Snik%
23878266SnikAny user that is a member of the wheel group can use "su -" to simulate
23978266Snika root login. You can add a user to the wheel group by editing /etc/group.
24078796Sdd		-- Konstantinos Konstantinidis <kkonstan@duth.gr>
24178271Snik%
24278271SnikOver quota?  "du -s * | sort -n " will give you a sorted list of your
24378271Snikdirectory sizes.
24478271Snik		-- David Scheidt <dscheidt@tumbolia.com>
24578271Snik%
24678271SnikHandy bash(1) prompt:   PS1="\u@\h \w \!$ "
24778271Snik		-- David Scheidt <dscheidt@tumbolia.com>
24878271Snik%
24978271SnikEver wonder what those numbers after command names were, as in cat(1)?  It's
25078271Snikthe section of the manual the man page is in.  "man man" will tell you more.
25178271Snik		-- David Scheidt <dscheidt@tumbolia.com>
25278271Snik%
25378271Snik"man hier" will explain the way FreeBSD filesystems are normally laid out.
25478271Snik		-- David Scheidt <dscheidt@tumbolia.com>
25578271Snik%
25678271Snik"man tuning" gives some tips how to tune performance of your FreeBSD system.
25778271Snik		-- David Scheidt <dscheidt@tumbolia.com>
25878271Snik%
25978271Snik"man firewall" will give advice for building a FreeBSD firewall
26078271Snik		-- David Scheidt <dscheidt@tumbolia.com>
26178283Seivind%
26278283SeivindYou can often get answers to your questions about FreeBSD by searching in the
26378283SeivindFreeBSD mailing list archives at
26478283Seivind
265148797Skrion	http://www.freebsd.org/search/search.html
26678283Seivind%
26778283SeivindYou can adjust the volume of various parts of the sound system in your
26878283Seivindcomputer by typing 'mixer <type> <volume>'.  To get a list of what you can
26978283Seivindadjust, just type 'mixer'.
27078283Seivind%
27178283SeivindYou can automatically download and install binary packages by doing
27278283Seivind
27378283Seivind	pkg_add -r <URL>
27478283Seivind
27578283Seivindwhere you replace <URL> with the URL to the package.  This will also
27678283Seivindautomatically install the packages the package you download is dependent on
27778283Seivind(ie, the packages it needs in order to work.)
27878283Seivind%
27978283SeivindYou can get a good standard workstation install by using the
28078283Seivindinstant-workstation port/package.  If you have ports installed, you can
28178283Seivindinstall it by doing
28278283Seivind
28378283Seivind	# cd /usr/ports/misc/instant-workstation
28478283Seivind	# make install && make clean
28578283Seivind
28678283Seivindas root.  This will install a collection of packages that is convenient to
28778283Seivindhave on a workstation.
28878283Seivind%
28978283SeivindYou can get a good generic server install by using the
29078283Seivindinstant-server port/package.  If you have ports installed, you can
29178283Seivindinstall it by doing
29278283Seivind
29378283Seivind	# cd /usr/ports/misc/instant-server
29478283Seivind	# make install && make clean
29578283Seivind
29678283Seivindas root.  This will install a collection of packages that is appropriate for
29778283Seivindrunning a "generic" server.
29881558Smharo%
29995677SdougbYou can make a log of your terminal session with script(1).
30081558Smharo%
30195677Sdougb"man ports" gives many useful hints about installing FreeBSD ports.
30281558Smharo%
30393518Sjoe"man security" gives very good advice on how to tune the security of your
30493518SjoeFreeBSD system.
30593518Sjoe%
30693518SjoeWant to find a specific port, just type the following under /usr/ports,
30793518Sjoeor one its subdirectories:
30893518Sjoe
309134243Sblackend	"make search name=<port-name>"
31093518Sjoe    or
311134243Sblackend	"make search key=<keyword>"
31293518Sjoe%
31393518SjoeWant to see how much virtual memory you're using? Just type "swapinfo" to
31493518Sjoebe shown information about the usage of your swap partitions.
31593518Sjoe%
31695677Sdougbports/net/netcat port is useful not only for redirecting input/output
317148797Skrionto TCP or UDP connections, but also for proxying them with inetd(8).
31881558Smharo%
31995677SdougbIf other operating systems have damaged your Master Boot Record, you can
32095677Sdougbreinstall it either with /stand/sysinstall or with boot0cfg(8). See
32178352Snik"man boot0cfg" for details.
32281558Smharo%
32395677SdougbNeed to see the calendar for this month? Simply type "cal".  To see the
32499534Smpwhole year, type "cal -y".
32578355Snik		-- Dru <genesis@istar.ca>
32681558Smharo%
32795677SdougbNeed to quickly return to your home directory? Type "cd".
32878355Snik		-- Dru <genesis@istar.ca>
32981558Smharo%
33095677SdougbTo see the last time that you logged in, use lastlogin(8).
33178355Snik		-- Dru <genesis@istar.ca>
33281558Smharo%
33395677SdougbTo clear the screen, use "clear". To re-display your screen buffer, press
33495677Sdougbthe scroll lock key and use your page up button. When you're finished,
33595677Sdougbpress the scroll lock key again to get your prompt back.
33678355Snik		-- Dru <genesis@istar.ca>
33781558Smharo%
338105517StomTo save disk space in your home directory, compress files you rarely
339105517Stomuse with "gzip filename".
34078355Snik		-- Dru <genesis@istar.ca>
34181558Smharo%
34295677SdougbTo read a compressed file without having to first uncompress it, use
34395677Sdougb"zcat" or "zmore" to view it.
34478355Snik		-- Dru <genesis@istar.ca>
34581558Smharo%
34695677SdougbTo see how much disk space is left on your partitions, use
34778355Snik
34878355Snik	df -h
34978355Snik		-- Dru <genesis@istar.ca>
35081558Smharo%
35195677SdougbTo see the 10 largest files on a directory or partition, use
35278355Snik
35378355Snik	du /partition_or_directory_name | sort -rn | head
35478355Snik		-- Dru <genesis@istar.ca>
35581558Smharo%
35695677SdougbTo determine whether a file is a text file, executable, or some other type
35795677Sdougbof file, use
35878355Snik
35978355Snik	file filename
36078355Snik		-- Dru <genesis@istar.ca>
36181558Smharo%
36295677SdougbTime to change your password? Type "passwd" and follow the prompts.
36378355Snik		-- Dru <genesis@istar.ca>
36481558Smharo%
36595677SdougbWant to know how many words, lines, or bytes are contained in a file? Type
36695677Sdougb"wc filename".
36778355Snik		-- Dru <genesis@istar.ca>
36881558Smharo%
36995677SdougbNeed to print a manpage? Use
37078355Snik
37178458Sdd	man name_of_manpage | col -bx | lpr
37278355Snik		-- Dru <genesis@istar.ca>
37381558Smharo%
37495677SdougbNeed to remove all those ^M characters from a DOS file? Try
37578355Snik
376142806Syar	tr -d \\r < dosfile > newfile
377142806Syar		-- Originally by Dru <genesis@istar.ca>
37881558Smharo%
37995677SdougbForget what directory you are in? Type "pwd".
38078355Snik		-- Dru <genesis@istar.ca>
38181558Smharo%
38295677SdougbIf you are in the C shell and have just installed a new program, you won't
38395677Sdougbbe able to run it unless you first type "rehash".
38478355Snik		-- Dru <genesis@istar.ca>
38581558Smharo%
38695677SdougbNeed to leave your terminal for a few minutes and don't want to logout?
38795677SdougbUse "lock -p". When you return, use your password as the key to unlock the
38895677Sdougbterminal.
38978355Snik		-- Dru <genesis@istar.ca>
39081558Smharo%
39195677SdougbNeed to find the location of a program? Use "locate program_name".
39278355Snik		-- Dru <genesis@istar.ca>
39381558Smharo%
39495677SdougbForget how to spell a word or a variation of a word? Use
39578355Snik
39678355Snik	look portion_of_word_you_know
39778355Snik		-- Dru <genesis@istar.ca>
39881558Smharo%
39995677SdougbTo see the last 10 lines of a long file, use "tail filename". To see the
40095677Sdougbfirst 10 lines, use "head filename".
40178355Snik		-- Dru <genesis@istar.ca>
40281558Smharo%
40395677SdougbTo see how long it takes a command to run, type the word "time" before the
40495677Sdougbcommand name.
40578355Snik		-- Dru <genesis@istar.ca>
40681558Smharo%
40795677SdougbTo quickly create an empty file, use "touch filename".
40878355Snik		-- Dru <genesis@istar.ca>
40981558Smharo%
41095677SdougbTo find out the hostname associated with an IP address, use
41178355Snik
41278355Snik	dig -x IP_address
41378355Snik		-- Dru <genesis@istar.ca>
41481558Smharo%
41595677SdougbIf you use the C shell, add the following line to the .cshrc file in your
41695677Sdougbhome directory to prevent core files from being written to disk:
41778355Snik
41878355Snik	limit coredumpsize 0
41978355Snik		-- Dru <genesis@istar.ca>
42081558Smharo%
42199995SdwmaloneIf you need a reminder to leave your terminal, type "leave +hhmm" where
42295677Sdougb"hhmm" represents in how many hours and minutes you need to leave.
42378355Snik		-- Dru <genesis@istar.ca>
42481558Smharo%
42595677SdougbNeed to do a search in a manpage or in a file you've sent to a pager? Use
42695677Sdougb"/search_word". To repeat the same search, type "n" for next.
42778355Snik		-- Dru <genesis@istar.ca>
42881558Smharo%
42995677SdougbForget when Easter is? Try "ncal -e". If you need the date for Orthodox
43095677SdougbEaster, use "ncal -o" instead.
43178355Snik		-- Dru <genesis@istar.ca>
43281558Smharo%
43395677SdougbNeed to see your routing table? Type "netstat -rn". The entry with the G
43495677Sdougbflag is your gateway.
43578355Snik		-- Dru <genesis@istar.ca>
43681558Smharo%
43795677SdougbNeed to see which daemons are listening for connection requests? Use
43895677Sdougb"sockstat -4l" for IPv4, and "sockstat -l" for IPv4 and IPv6.
43978355Snik		-- Dru <genesis@istar.ca>
44081558Smharo%
441139631SjosefCan't remember if you've installed a certain port or not? Try "pkg_info 
442139631Sjosef-Ix port_name".
44381558Smharo%
44495677SdougbTo erase a line you've written at the command prompt, use "Ctrl-U".
44578355Snik		-- Dru <genesis@istar.ca>
44681558Smharo%
44795677SdougbTo repeat the last command in the C shell, type "!!".
44878355Snik		-- Dru <genesis@istar.ca>
44981558Smharo%
450118366SschweikhNeed to quickly empty a file? Use ": > filename".
45178355Snik		-- Dru <genesis@istar.ca>
45281558Smharo%
45395677SdougbTo see all of the directories on your FreeBSD system, type
45478355Snik
45578471Snik	ls -R / | more
45678355Snik		-- Dru <genesis@istar.ca>
45781558Smharo%
45895677SdougbTo see the IP addresses currently set on your active interfaces, type
45995677Sdougb"ifconfig -u".
46078355Snik		-- Dru <genesis@istar.ca>
46181558Smharo%
46295677SdougbTo see the MAC addresses of the NICs on your system, type
46378355Snik
46478471Snik	ifconfig -a
46578355Snik		-- Dru <genesis@istar.ca>
46678471Snik%
46778773SbrianYou can open up a new split-screen window in (n)vi with :N or :E and then
46878773Sbrianuse ^w to switch between the two.
46978774Sbrian%
470125955Scpercivash (the default Bourne shell in FreeBSD) supports command-line editing.  Just
47178774Sbrian``set -o emacs'' or ``set -o vi'' to enable it.
47278777Sbrian%
47378777SbrianWhen you've made modifications to a file in vi(1) and then find that
47478777Sbrianyou can't write it, type ``<ESC>!rm -f %'' then ``:w!'' to force the
47578777Sbrianwrite
47678777Sbrian
47778777SbrianThis won't work if you don't have write permissions to the directory
47878777Sbrianand probably won't be suitable if you're editing through a symbolic link.
47990516Skeramida%
48090516SkeramidaIf you want to quickly check for duplicate package/port installations,
48190516Skeramidatry the following pkg_info command.
48290516Skeramida
48390516Skeramida	pkg_info | sort | sed -e 's/-[0-9].*$//' | \
48490516Skeramida	uniq -c | grep -v '^[[:space:]]*1'
485102943Sjmallett%
486102943SjmallettWant to use sed(1) to edit a file in place?  Well, to replace every 'e' with
487102943Sjmallettan 'o', in a file named 'foo', you can do:
488102943Sjmallett
489102943Sjmallett	sed -i.bak s/e/o/g foo
490102943Sjmallett
491102943SjmallettAnd you'll get a backup of the original in a file named 'foo.bak', but if you
492102943Sjmallettwant no backup:
493102943Sjmallett
494102943Sjmallett	sed -i '' s/e/o/g foo
495124230Sblackend%
496124230SblackendTo obtain a neat PostScript rendering of a manual page, use ``-t'' switch
497124230Sblackendof the man(1) utility: ``man -t <topic>''.  For example:
498124230Sblackend
499124230Sblackend	man -t grep > grep.ps	# Save the PostScript version to a file
500124230Sblackendor
501124230Sblackend	man -t printf | lp	# Send the PostScript directly to printer
502163144Schinsan%
503163144SchinsanWant to strip UTF-8 BOM(Byte Order Mark) from given files?
504163144Schinsan
505163144Schinsan	sed -e '1s/^\xef\xbb\xbf//' < bomfile > newfile
506