freebsd-tips revision 99995
1199482SrdivackyThis fortune brought to you by:
2199482Srdivacky$FreeBSD: head/games/fortune/datfiles/freebsd-tips 99995 2002-07-14 22:50:12Z dwmalone $
3199482Srdivacky%
4199482SrdivackyHaving trouble using fetch through a firewall? Try setting the environment
5199482Srdivackyvariable FTP_PASSIVE_MODE to yes, and see fetch(3) for more details.
6199482Srdivacky%
7199482SrdivackyBy pressing "Scroll Lock" you can use the arrow keys to scroll backward
8199482Srdivackythrough the console output.  Press "Scroll Lock" again to turn it off.
9199482Srdivacky%
10199482SrdivackyWant colour in your directory listings?  Use "ls -G".  "ls -F" is also useful,
11199482Srdivackyand they can be combined as "ls -FG".
12234353Sdim%
13210299SedIf you need to ask a question on the FreeBSD-questions mailing list then
14199482Srdivacky
15199482Srdivacky	http://www.freebsd.org/doc/en_US.ISO8859-1/articles/\
16199482Srdivacky		freebsd-questions/index.html
17199482Srdivacky
18199482Srdivackycontains lots of useful advice to help you get the best results.
19199482Srdivacky%
20199482SrdivackyIf you'd like to keep track of applications in the FreeBSD ports tree, take a
21199482Srdivackylook at FreshPorts;
22212904Sdim
23207619Srdivacky	http://www.freshports.org/
24234353Sdim%
25212904SdimTo search for files that match a particular name, use find(1); for example
26199482Srdivacky
27226633Sdim	find / -name "*GENERIC*" -ls
28234353Sdim
29226633Sdimwill search '/', and all subdirectories, for files with 'GENERIC' in the name.
30199482Srdivacky      	--  Stephen Hilton <nospam@hiltonbsd.com>
31199482Srdivacky%
32199482SrdivackyIn tcsh, you can `set autolist' to have the shell automatically show
33205408Srdivackyall the possible matches when doing filename/directory expansion.
34205408Srdivacky%
35205408SrdivackyYou can `set autologout = 30' to have tcsh log you off automatically
36205408Srdivackyif you leave the shell idle for more than 30 minutes.
37226633Sdim%
38205408SrdivackyIf you `set filec' (file completion) in tcsh and write a part of the
39205408Srdivackyfilename, pressing TAB will show you the available choices when there
40205408Srdivackyis more than one, or complete the filename if there's only one match.
41205408Srdivacky%
42205408SrdivackyYou can press up-arrow or down-arrow to walk through a list of
43205408Srdivackyprevious commands in tcsh.
44205408Srdivacky%
45199482SrdivackyYou can disable tcsh's terminal beep if you `set nobeep'.
46199482Srdivacky%
47199482SrdivackyIf you `set watch (0 any any)' in tcsh, you will be notified when
48199482Srdivackysomeone logs in or out of your system.
49226633Sdim%
50226633SdimNice tcsh prompt: set prompt = '%m %# '
51200583Srdivacky%
52200583SrdivackyNice tcsh prompt: set prompt = '%n@%m%# '
53199482Srdivacky%
54199482SrdivackyNice tcsh prompt: set prompt = '%n@%m:%~%# '
55199482Srdivacky%
56226633SdimNice tcsh prompt: set prompt = '%n@%m:%/%# '
57199482Srdivacky%
58199482SrdivackyNice tcsh prompt: set prompt = '[%B%m%b] %B%~%b%# '
59199482Srdivacky%
60218893SdimSimple tcsh prompt: set prompt = '%# '
61226633Sdim%
62226633SdimIf you want df(1) and other commands to display disk sizes in
63218893Sdimkilobytes instead of 512-byte blocks, set BLOCKSIZE in your
64218893Sdimenvironment to 'K'.  You can also use 'M' for Megabytes or 'G' for
65218893SdimGigabytes.  If you want df(1) to automatically select the best size
66218893Sdimthen use 'df -h'.
67218893Sdim%
68218893SdimTo change an environment variable in tcsh you use: setenv NAME "value"
69218893Sdimwhere NAME is the name of the variable and "value" its new value.
70218893Sdim%
71199482SrdivackyTo change an environment variable in /bin/sh use:
72226633Sdim
73199482Srdivacky	$ VARIABLE="value"
74199482Srdivacky	$ export VARIABLE
75199482Srdivacky%
76199482SrdivackyYou can use /etc/make.conf to control the options used to compile software
77226633Sdimon this system.  Example entries are in /usr/share/examples/etc/make.conf.
78199482Srdivacky%
79199482SrdivackyTo do a fast search for a file, try
80199482Srdivacky
81199482Srdivacky	 locate filename
82226633Sdim
83212904Sdimlocate uses a database that is updated every Saturday (assuming your computer
84218893Sdimis running FreeBSD at the time) to quickly find files based on name only.
85226633Sdim%
86226633SdimIn order to search for a string in some files, use 'grep' like this:
87199482Srdivacky
88212904Sdim	 grep "string" filename1 [filename2 filename3 ...]
89226633Sdim
90226633SdimThis will print out the lines in the files that contain the string.  grep can
91234353Sdimalso do a lot more advanced searches - type 'man grep' for details.
92212904Sdim%
93212904SdimYou can use the 'fetch' command to retrieve files over ftp or http.
94212904Sdim
95226633Sdim	 fetch http://www.freebsd.org/index.html
96212904Sdim
97218893Sdimwill download the front page of the FreeBSD web site.
98226633Sdim%
99212904SdimIn order to make fetch (the FreeBSD downloading tool) ask for
100212904Sdimusername/password when it encounter a password-protected web page, you can set
101212904Sdimthe environment variable HTTP_AUTH to 'basic:*'.
102212904Sdim%
103199482SrdivackyYou can permanently set environment variables for your shell by putting them
104199482Srdivackyin a startup file for the shell.  The name of the startup file varies
105218893Sdimdepending on the shell - csh and tcsh uses .login, bash, sh, ksh and zsh use
106218893Sdim.profile.  When using bash, sh, ksh or zsh, don't forget to export the
107226633Sdimvariable.
108218893Sdim%
109226633SdimIf you are running xterm, the default TERM variable will be 'xterm'.  If you
110226633Sdimset this environment variable to 'xterm-color' instead, a lot of programs will
111200583Srdivackyuse colors.  You can do this by
112212904Sdim
113200583Srdivacky	TERM=xterm-color; export TERM
114218893Sdim
115212904Sdimin Bourne-derived shells, and
116199482Srdivacky
117199482Srdivacky	setenv TERM xterm-color
118234353Sdim
119234353Sdimin csh-derived shells.
120234353Sdim%
121234353SdimIf you do not want to get beeps in X11 (X Windows), you can turn them off with
122234353Sdim
123234353Sdim	xset b off
124234353Sdim%
125234353SdimYou can look through a file in a nice text-based interface by typing
126234353Sdim
127234353Sdim	less filename
128234353Sdim%
129234353SdimThe default editor in FreeBSD is vi, which is efficient to use when you have
130234353Sdimlearned it, but somewhat user-unfriendly.  To use ee (an easier but less
131234353Sdimpowerful editor) instead, set the environment variable EDITOR to /usr/bin/ee
132234353Sdim%
133234353SdimIf you accidently end up inside vi, you can quit it by pressing Escape, colon
134234353Sdim(:), q (q), bang (!) and pressing return.
135234353Sdim%
136234353SdimYou can use aliases to decrease the amount of typing you need to do to get
137234353Sdimcommands you commonly use.  Examples of fairly popular aliases include (in
138234353Sdimbourne shell style, as in /bin/sh, bash, ksh, and zsh):
139234353Sdim
140234353Sdim	alias lf="ls -FA"
141234353Sdim	alias ll="ls -lA"
142234353Sdim	alias su="su -m"
143234353Sdim
144234353SdimIn csh or tcsh, these would be
145234353Sdim
146234353Sdim	alias lf ls -FA
147234353Sdim	alias ll ls -lA
148234353Sdim	alias su su -m
149234353Sdim
150234353SdimTo remove an alias, you can usually use 'unalias aliasname'.  To list all
151234353Sdimaliases, you can usually type just 'alias'.
152234353Sdim%
153234353SdimIn order to support national characters for european languages in tools like
154234353Sdimless without creating other nationalisation aspects, set the environment
155234353Sdimvariable LC_ALL to 'en_US.ISO8859-1'.
156234353Sdim%
157234353SdimYou can search for documentation on a keyword by typing
158234353Sdim
159234353Sdim	apropos keyword
160234353Sdim%
161234353SdimMan pages are divided into section depending on topic.  There are 9 different
162234353Sdimsections numbered from 1 (General Commands) to 9 (Kernel Developer's Manual).
163234353SdimYou can get an introduction to each topic by typing
164234353Sdim
165234353Sdim	man <number> intro
166234353Sdim
167234353SdimIn other words, to get the intro to general commands, type
168234353Sdim
169234353Sdim	man 1 intro
170234353Sdim%
171234353SdimFreeBSD is started up by the program 'init'.  The first thing init does when
172234353Sdimstarting multiuser mode (ie, starting the computer up for normal use) is to
173234353Sdimrun the shell script /etc/rc.  By reading /etc/rc, you can learn a lot about
174234353Sdimhow the system is put together, which again will make you more confident about
175234353Sdimwhat happens when you do something with it.
176234353Sdim%
177234353SdimIf you want to play CDs with FreeBSD, a utility for this is already included.
178234353SdimType 'cdcontrol' then 'help' to learn more.  (You may need to set the CDROM
179234353Sdimenvironment variable in order to make cdcontrol want to start.)
180234353Sdim%
181234353SdimIf you have a CD-ROM drive in your machine, you can make the CD-ROM that is
182234353Sdimpresently inserted available by typing 'mount /cdrom' as root.   The CD-ROM
183234353Sdimwill be available under /cdrom/.  Remember to do 'umount /cdrom' before
184234353Sdimremoving the CD-ROM (it will usually not be possible to remove the CD-ROM
185234353Sdimwithout doing this.)
186234353Sdim
187234353SdimNote: This tip may not work in all configurations.
188234353Sdim%
189234353SdimYou can install extra packages for FreeBSD by using the ports system.
190234353SdimIf you have installed it, you can download, compile, and install software by
191234353Sdimjust typing
192234353Sdim
193234353Sdim	# cd /usr/ports/<category>/<portname>
194234353Sdim	# make install && make clean
195234353Sdim
196234353Sdimas root.   The ports infrastructure will download the software, change it so
197234353Sdimit works on FreeBSD, compile it, install it, register the installation so it
198234353Sdimwill be possible to automatically uninstall it, and clean out the temporary
199234353Sdimworking space it used.  You can remove an installed port you decide you do not
200234353Sdimwant after all by typing
201234353Sdim
202234353Sdim	# cd /usr/ports/<category>/<portname>
203234353Sdim	# make deinstall
204234353Sdim
205234353Sdimas root.
206234353Sdim%
207234353SdimNice bash prompt: PS1='(\[$(tput md)\]\t <\w>\[$(tput me)\]) $(echo $?) \$ '
208234353Sdim		-- Mathieu <mathieu@hal.interactionvirtuelle.com>
209234353Sdim%
210234353SdimTo see the output from when your computer started, run dmesg(8).  If it has
211234353Sdimbeen replaced with other messages, look at /var/run/dmesg.boot.
212234353Sdim		-- Francisco Reyes <lists@natserv.com>
213234353Sdim%
214234353SdimYou can use "whereis" to locate standard binary, manual page and source
215234353Sdimdirectories for the specified programs. This can be particularly handy
216234353Sdimwhen you are trying to find where in the ports tree an application is.
217234353Sdim
218234353SdimTry "whereis netscape" and "whereis whereis".
219234353Sdim		-- Konstantinos Konstantinidis <kkonstan@duth.gr>
220234353Sdim%
221234353SdimYou can press Ctrl-D to quickly exit from a shell, or logout from a
222234353Sdimlogin shell.
223234353Sdim		-- Konstantinos Konstantinidis <kkonstan@duth.gr>
224234353Sdim%
225234353SdimYou can use "pkg_info" to see a list of packages you have installed.
226234353Sdim		-- Konstantinos Konstantinidis <kkonstan@duth.gr>
227234353Sdim%
228234353SdimYou can change the video mode on all consoles by adding something like
229234353Sdimthe following to /etc/rc.conf:
230234353Sdim
231234353Sdim	allscreens="80x30"
232234353Sdim
233234353SdimYou can use "vidcontrol -i mode | grep T" for a list of supported text
234234353Sdimmodes.
235234353Sdim		-- Konstantinos Konstantinidis <kkonstan@duth.gr>
236234353Sdim%
237234353SdimAny user that is a member of the wheel group can use "su -" to simulate
238234353Sdima root login. You can add a user to the wheel group by editing /etc/group.
239234353Sdim		-- Konstantinos Konstantinidis <kkonstan@duth.gr>
240234353Sdim%
241234353SdimOver quota?  "du -s * | sort -n " will give you a sorted list of your
242234353Sdimdirectory sizes.
243234353Sdim		-- David Scheidt <dscheidt@tumbolia.com>
244234353Sdim%
245234353SdimHandy bash(1) prompt:   PS1="\u@\h \w \!$ "
246234353Sdim		-- David Scheidt <dscheidt@tumbolia.com>
247234353Sdim%
248234353SdimEver wonder what those numbers after command names were, as in cat(1)?  It's
249234353Sdimthe section of the manual the man page is in.  "man man" will tell you more.
250234353Sdim		-- David Scheidt <dscheidt@tumbolia.com>
251234353Sdim%
252234353Sdim"man hier" will explain the way FreeBSD filesystems are normally laid out.
253234353Sdim		-- David Scheidt <dscheidt@tumbolia.com>
254234353Sdim%
255234353Sdim"man tuning" gives some tips how to tune performance of your FreeBSD system.
256234353Sdim		-- David Scheidt <dscheidt@tumbolia.com>
257234353Sdim%
258234353Sdim"man firewall" will give advice for building a FreeBSD firewall
259234353Sdim		-- David Scheidt <dscheidt@tumbolia.com>
260234353Sdim%
261234353SdimYou can often get answers to your questions about FreeBSD by searching in the
262234353SdimFreeBSD mailing list archives at
263234353Sdim
264234353Sdim	http://www.freebsd.org/search.html
265234353Sdim%
266234353SdimYou can adjust the volume of various parts of the sound system in your
267234353Sdimcomputer by typing 'mixer <type> <volume>'.  To get a list of what you can
268234353Sdimadjust, just type 'mixer'.
269234353Sdim%
270234353SdimYou can automatically download and install binary packages by doing
271234353Sdim
272234353Sdim	pkg_add -r <URL>
273234353Sdim
274234353Sdimwhere you replace <URL> with the URL to the package.  This will also
275234353Sdimautomatically install the packages the package you download is dependent on
276234353Sdim(ie, the packages it needs in order to work.)
277234353Sdim%
278234353SdimYou can get a good standard workstation install by using the
279234353Sdiminstant-workstation port/package.  If you have ports installed, you can
280234353Sdiminstall it by doing
281234353Sdim
282234353Sdim	# cd /usr/ports/misc/instant-workstation
283234353Sdim	# make install && make clean
284234353Sdim
285234353Sdimas root.  This will install a collection of packages that is convenient to
286234353Sdimhave on a workstation.
287234353Sdim%
288234353SdimYou can get a good generic server install by using the
289234353Sdiminstant-server port/package.  If you have ports installed, you can
290234353Sdiminstall it by doing
291234353Sdim
292234353Sdim	# cd /usr/ports/misc/instant-server
293234353Sdim	# make install && make clean
294234353Sdim
295234353Sdimas root.  This will install a collection of packages that is appropriate for
296234353Sdimrunning a "generic" server.
297234353Sdim%
298234353SdimYou can make a log of your terminal session with script(1).
299234353Sdim%
300234353Sdim"man ports" gives many useful hints about installing FreeBSD ports.
301234353Sdim%
302234353Sdim"man security" gives very good advice on how to tune the security of your
303234353SdimFreeBSD system.
304234353Sdim%
305234353SdimWant to find a specific port, just type the following under /usr/ports,
306234353Sdimor one its subdirectories:
307234353Sdim
308234353Sdim	"make search port=<port-name>"
309234353Sdim    or
310234353Sdim	"make search key="<keyword>"
311234353Sdim%
312234353SdimWant to see how much virtual memory you're using? Just type "swapinfo" to
313234353Sdimbe shown information about the usage of your swap partitions.
314234353Sdim%
315234353Sdimports/net/netcat port is useful not only for redirecting input/output
316234353Sdimto TCP or UDP connections, but also for proxying them. See inetd(8) for
317234353Sdimdetails.
318234353Sdim%
319234353SdimIf other operating systems have damaged your Master Boot Record, you can
320234353Sdimreinstall it either with /stand/sysinstall or with boot0cfg(8). See
321234353Sdim"man boot0cfg" for details.
322234353Sdim%
323234353SdimNeed to see the calendar for this month? Simply type "cal".  To see the
324234353Sdimwhole year, type "cal -y".
325234353Sdim		-- Dru <genesis@istar.ca>
326234353Sdim%
327234353SdimNeed to quickly return to your home directory? Type "cd".
328234353Sdim		-- Dru <genesis@istar.ca>
329234353Sdim%
330234353SdimTo see the last time that you logged in, use lastlogin(8).
331234353Sdim		-- Dru <genesis@istar.ca>
332234353Sdim%
333234353SdimTo clear the screen, use "clear". To re-display your screen buffer, press
334234353Sdimthe scroll lock key and use your page up button. When you're finished,
335234353Sdimpress the scroll lock key again to get your prompt back.
336234353Sdim		-- Dru <genesis@istar.ca>
337234353Sdim%
338234353SdimTo save disk space in your home directory, can compress files you
339234353Sdimrarely use with "gzip filename".
340234353Sdim		-- Dru <genesis@istar.ca>
341234353Sdim%
342234353SdimTo read a compressed file without having to first uncompress it, use
343234353Sdim"zcat" or "zmore" to view it.
344234353Sdim		-- Dru <genesis@istar.ca>
345234353Sdim%
346234353SdimTo see how much disk space is left on your partitions, use
347234353Sdim
348234353Sdim	df -h
349234353Sdim		-- Dru <genesis@istar.ca>
350234353Sdim%
351234353SdimTo see the 10 largest files on a directory or partition, use
352234353Sdim
353199482Srdivacky	du /partition_or_directory_name | sort -rn | head
354226633Sdim		-- Dru <genesis@istar.ca>
355199482Srdivacky%
356199482SrdivackyTo determine whether a file is a text file, executable, or some other type
357199482Srdivackyof file, use
358234353Sdim
359234353Sdim	file filename
360234353Sdim		-- Dru <genesis@istar.ca>
361234353Sdim%
362234353SdimTime to change your password? Type "passwd" and follow the prompts.
363234353Sdim		-- Dru <genesis@istar.ca>
364234353Sdim%
365234353SdimWant to know how many words, lines, or bytes are contained in a file? Type
366234353Sdim"wc filename".
367234353Sdim		-- Dru <genesis@istar.ca>
368234353Sdim%
369234353SdimNeed to print a manpage? Use
370234353Sdim
371234353Sdim	man name_of_manpage | col -bx | lpr
372234353Sdim		-- Dru <genesis@istar.ca>
373234353Sdim%
374234353SdimNeed to remove all those ^M characters from a DOS file? Try
375234353Sdim
376234353Sdim	col -bx < dosfile > newfile
377234353Sdim		-- Dru <genesis@istar.ca>
378234353Sdim%
379234353SdimForget what directory you are in? Type "pwd".
380234353Sdim		-- Dru <genesis@istar.ca>
381234353Sdim%
382234353SdimIf you are in the C shell and have just installed a new program, you won't
383234353Sdimbe able to run it unless you first type "rehash".
384234353Sdim		-- Dru <genesis@istar.ca>
385234353Sdim%
386234353SdimNeed to leave your terminal for a few minutes and don't want to logout?
387234353SdimUse "lock -p". When you return, use your password as the key to unlock the
388234353Sdimterminal.
389234353Sdim		-- Dru <genesis@istar.ca>
390234353Sdim%
391234353SdimNeed to find the location of a program? Use "locate program_name".
392234353Sdim		-- Dru <genesis@istar.ca>
393234353Sdim%
394234353SdimForget how to spell a word or a variation of a word? Use
395234353Sdim
396234353Sdim	look portion_of_word_you_know
397234353Sdim		-- Dru <genesis@istar.ca>
398234353Sdim%
399234353SdimTo see the last 10 lines of a long file, use "tail filename". To see the
400234353Sdimfirst 10 lines, use "head filename".
401234353Sdim		-- Dru <genesis@istar.ca>
402234353Sdim%
403234353SdimTo see how long it takes a command to run, type the word "time" before the
404234353Sdimcommand name.
405234353Sdim		-- Dru <genesis@istar.ca>
406234353Sdim%
407234353SdimTo quickly create an empty file, use "touch filename".
408234353Sdim		-- Dru <genesis@istar.ca>
409234353Sdim%
410234353SdimTo find out the hostname associated with an IP address, use
411234353Sdim
412234353Sdim	dig -x IP_address
413234353Sdim		-- Dru <genesis@istar.ca>
414234353Sdim%
415234353SdimIf you use the C shell, add the following line to the .cshrc file in your
416234353Sdimhome directory to prevent core files from being written to disk:
417234353Sdim
418234353Sdim	limit coredumpsize 0
419234353Sdim		-- Dru <genesis@istar.ca>
420234353Sdim%
421234353SdimIf you need a reminder to leave your terminal, type "leave +hhmm" where
422234353Sdim"hhmm" represents in how many hours and minutes you need to leave.
423234353Sdim		-- Dru <genesis@istar.ca>
424234353Sdim%
425234353SdimNeed to do a search in a manpage or in a file you've sent to a pager? Use
426234353Sdim"/search_word". To repeat the same search, type "n" for next.
427234353Sdim		-- Dru <genesis@istar.ca>
428234353Sdim%
429199482SrdivackyForget when Easter is? Try "ncal -e". If you need the date for Orthodox
430199482SrdivackyEaster, use "ncal -o" instead.
431199482Srdivacky		-- Dru <genesis@istar.ca>
432199482Srdivacky%
433199482SrdivackyNeed to see your routing table? Type "netstat -rn". The entry with the G
434199482Srdivackyflag is your gateway.
435199482Srdivacky		-- Dru <genesis@istar.ca>
436199482Srdivacky%
437199482SrdivackyNeed to see which daemons are listening for connection requests? Use
438199990Srdivacky"sockstat -4l" for IPv4, and "sockstat -l" for IPv4 and IPv6.
439234353Sdim		-- Dru <genesis@istar.ca>
440199482Srdivacky%
441199482SrdivackyCan't remember is you've installed a certain port or not? Try "pkg_info |
442199482Srdivackygrep port_name".
443199482Srdivacky		-- Dru <genesis@istar.ca>
444199482Srdivacky%
445199482SrdivackyGot some time to kill? Try typing "hangman".
446199990Srdivacky		-- Dru <genesis@istar.ca>
447199482Srdivacky%
448199482SrdivackyTo erase a line you've written at the command prompt, use "Ctrl-U".
449199482Srdivacky		-- Dru <genesis@istar.ca>
450199482Srdivacky%
451199482SrdivackyTo repeat the last command in the C shell, type "!!".
452199482Srdivacky		-- Dru <genesis@istar.ca>
453199482Srdivacky%
454199482SrdivackyNeed to quickly empty a file? Use "echo > filename".
455207619Srdivacky		-- Dru <genesis@istar.ca>
456199482Srdivacky%
457199482SrdivackyTo see all of the directories on your FreeBSD system, type
458199482Srdivacky
459199990Srdivacky	ls -R / | more
460199482Srdivacky		-- Dru <genesis@istar.ca>
461199482Srdivacky%
462199482SrdivackyTo see the IP addresses currently set on your active interfaces, type
463199482Srdivacky"ifconfig -u".
464199482Srdivacky		-- Dru <genesis@istar.ca>
465199482Srdivacky%
466199482SrdivackyTo see the MAC addresses of the NICs on your system, type
467199482Srdivacky
468199482Srdivacky	ifconfig -a
469207619Srdivacky		-- Dru <genesis@istar.ca>
470199482Srdivacky%
471199482SrdivackyYou can save your kernel startup configuration with kget(8).  The
472199482SrdivackyConfiguration can be edited at boot time with 'boot -c' command in loader.
473200583SrdivackySee boot(8), loader(8) for details.
474200583Srdivacky%
475199482SrdivackyYou can open up a new split-screen window in (n)vi with :N or :E and then
476199482Srdivackyuse ^w to switch between the two.
477199482Srdivacky%
478199482Srdivackysh (the default bourne shell in FreeBSD) supports command-line editing.  Just
479199482Srdivacky``set -o emacs'' or ``set -o vi'' to enable it.
480199482Srdivacky%
481210299SedWhen you've made modifications to a file in vi(1) and then find that
482210299Sedyou can't write it, type ``<ESC>!rm -f %'' then ``:w!'' to force the
483210299Sedwrite
484199482Srdivacky
485199482SrdivackyThis won't work if you don't have write permissions to the directory
486207619Srdivackyand probably won't be suitable if you're editing through a symbolic link.
487199482Srdivacky%
488199482SrdivackyIf you want to quickly check for duplicate package/port installations,
489199482Srdivackytry the following pkg_info command.
490199482Srdivacky
491199482Srdivacky	pkg_info | sort | sed -e 's/-[0-9].*$//' | \
492199482Srdivacky	uniq -c | grep -v '^[[:space:]]*1'
493199482Srdivacky