Merge from vendor branch FILE:
[games.git] / games / fortune / datfiles / dragonfly-tips
1 This fortune brought to you by:
2 $FreeBSD: src/games/fortune/datfiles/freebsd-tips,v 1.14.2.11 2003/03/15 08:48:29 dougb Exp $
3 $DragonFly: src/games/fortune/datfiles/dragonfly-tips,v 1.3 2007/11/19 18:49:06 swildner Exp $
4 %
5 Having trouble using fetch through a firewall? Try setting the environment
6 variable FTP_PASSIVE_MODE to yes, and see fetch(3) for more details.
7 %
8 By pressing "Scroll Lock" you can use the arrow keys to scroll backward
9 through the console output.  Press "Scroll Lock" again to turn it off.
10 %
11 Want colour in your directory listings?  Use "ls -G".  "ls -F" is also useful,
12 and they can be combined as "ls -FG".
13 %
14 If you'd like to keep track of applications in the pkgsrc tree, take a look
15 at pkgsrc.se;
16
17         http://www.pkgsrc.se/
18 %
19 To search for files that match a particular name, use find(1); for example
20
21         find / -name "*GENERIC*" -ls
22
23 will search '/', and all subdirectories, for files with 'GENERIC' in the name.
24        --  Stephen Hilton <nospam@hiltonbsd.com>
25 %
26 In tcsh, you can `set autolist' to have the shell automatically show
27 all the possible matches when doing filename/directory expansion.
28 %
29 You can `set autologout = 30' to have tcsh log you off automatically
30 if you leave the shell idle for more than 30 minutes.
31 %
32 If you `set filec' (file completion) in tcsh and write a part of the
33 filename, pressing TAB will show you the available choices when there
34 is more than one, or complete the filename if there's only one match.
35 %
36 You can press up-arrow or down-arrow to walk through a list of
37 previous commands in tcsh.
38 %
39 You can disable tcsh's terminal beep if you `set nobeep'.
40 %
41 If you `set watch = (0 any any)' in tcsh, you will be notified when
42 someone logs in or out of your system.
43 %
44 Nice tcsh prompt: set prompt = '%m %# '
45 %
46 Nice tcsh prompt: set prompt = '%n@%m%# '
47 %
48 Nice tcsh prompt: set prompt = '%n@%m:%~%# '
49 %
50 Nice tcsh prompt: set prompt = '%n@%m:%/%# '
51 %
52 Nice tcsh prompt: set prompt = '[%B%m%b] %B%~%b%# '
53 %
54 Simple tcsh prompt: set prompt = '%# '
55 %
56 If you want df(1) and other commands to display disk sizes in
57 kilobytes instead of 512-byte blocks, set BLOCKSIZE in your
58 environment to 'K'.  You can also use 'M' for Megabytes or 'G' for
59 Gigabytes.  If you want df(1) to automatically select the best size
60 then use 'df -h'.
61 %
62 To change an environment variable in tcsh you use: setenv NAME "value"
63 where NAME is the name of the variable and "value" its new value.
64 %
65 To change an environment variable in /bin/sh use:
66
67         $ VARIABLE="value"
68         $ export VARIABLE
69 %
70 You can use /etc/make.conf to control the options used to compile software
71 on this system.  Example entries are in
72 /etc/defaults/make.conf.
73 %
74 To do a fast search for a file, try
75
76          locate filename
77
78 locate uses a database that is updated every Saturday (assuming your computer
79 is running DragonFly BSD at the time) to quickly find files based on name only.
80 %
81 In order to search for a string in some files, use 'grep' like this:
82
83          grep "string" filename1 [filename2 filename3 ...]
84
85 This will print out the lines in the files that contain the string.  grep can
86 also do a lot more advanced searches - type 'man grep' for details.
87 %
88 You can use the 'fetch' command to retrieve files over ftp or http.
89
90          fetch http://www.dragonflybsd.org/
91
92 will download the front page of the DragonFly BSD web site.
93 %
94 In order to make fetch (the DragonFly BSD downloading tool) ask for
95 username/password when it encounter a password-protected web page, you can set
96 the environment variable HTTP_AUTH to 'basic:*'.
97 %
98 You can permanently set environment variables for your shell by putting them
99 in a startup file for the shell.  The name of the startup file varies
100 depending on the shell - csh and tcsh uses .login, bash, sh, ksh and zsh use
101 .profile.  When using bash, sh, ksh or zsh, don't forget to export the
102 variable.
103 %
104 If you are running xterm, the default TERM variable will be 'xterm'.  If you
105 set this environment variable to 'xterm-color' instead, a lot of programs will
106 use colors.  You can do this by
107
108         TERM=xterm-color; export TERM
109
110 in Bourne-derived shells, and
111
112         setenv TERM xterm-color
113
114 in csh-derived shells.
115 %
116 If you do not want to get beeps in X11 (X Windows), you can turn them off with
117
118         xset b off
119 %
120 You can look through a file in a nice text-based interface by typing
121
122         less filename
123 %
124 The default editor in DragonFly BSD is vi, which is efficient to use when you 
125 have learned it, but somewhat user-unfriendly.  To use ee (an easier but less
126 powerful editor) instead, set the environment variable EDITOR to /usr/bin/ee
127 %
128 If you accidently end up inside vi, you can quit it by pressing Escape, colon
129 (:), q (q), bang (!) and pressing return.
130 %
131 You can use aliases to decrease the amount of typing you need to do to get
132 commands you commonly use.  Examples of fairly popular aliases include (in
133 bourne shell style, as in /bin/sh, bash, ksh, and zsh):
134
135         alias lf="ls -FA"
136         alias ll="ls -lA"
137         alias su="su -m"
138
139 In csh or tcsh, these would be
140
141         alias lf ls -FA
142         alias ll ls -lA
143         alias su su -m
144
145 To remove an alias, you can usually use 'unalias aliasname'.  To list all
146 aliases, you can usually type just 'alias'.
147 %
148 In order to support national characters for european languages in tools like
149 less without creating other nationalisation aspects, set the environment
150 variable LC_ALL to 'en_US.ISO8859-1'.
151 %
152 You can search for documentation on a keyword by typing
153
154         apropos keyword
155 %
156 Man pages are divided into section depending on topic.  There are 9 different
157 sections numbered from 1 (General Commands) to 9 (Kernel Developer's Manual).
158 You can get an introduction to each topic by typing
159
160         man <number> intro
161
162 In other words, to get the intro to general commands, type
163
164         man 1 intro
165 %
166 DragonFly BSD is started up by the program 'init'.  The first thing init does 
167 when starting multiuser mode (ie, starting the computer up for normal use) is 
168 to run the shell script /etc/rc.  By reading /etc/rc, you can learn a lot about
169 how the system is put together, which again will make you more confident about
170 what happens when you do something with it.
171 %
172 If you want to play CDs with DragonFly BSD, a utility for this is already 
173 included.  Type 'cdcontrol' then 'help' to learn more.  (You may need to set 
174 the CDROM environment variable in order to make cdcontrol want to start.)
175 %
176 If you have a CD-ROM drive in your machine, you can make the CD-ROM that is
177 presently inserted available by typing 'mount /cdrom' as root.   The CD-ROM
178 will be available under /cdrom/.  Remember to do 'umount /cdrom' before
179 removing the CD-ROM (it will usually not be possible to remove the CD-ROM
180 without doing this.)
181
182 Note: This tip may not work in all configurations.
183 %
184 You can install extra packages for DragonFly BSD by using the pkgsrc system.
185 If you have installed it, you can download, compile, and install software by
186 just typing
187
188         # cd /usr/pkgsrc/<category>/<package name>
189         # bmake install clean
190
191 as root.   The pkgsrc infrastructure will download the software, change it so
192 it works on DragonFly BSD, compile it, install it, register the installation 
193 so it will be possible to automatically uninstall it, and clean out the 
194 temporary working space it used.  You can remove an installed package you 
195 decide you do not want after all by typing
196
197         # cd /usr/pkgsrc/<category>/<package name>
198         # bmake deinstall
199
200 as root.
201 %
202 Nice bash prompt: PS1='(\[$(tput md)\]\t <\w>\[$(tput me)\]) $(echo $?) \$ '
203                 -- Mathieu <mathieu@hal.interactionvirtuelle.com>
204 %
205 To see the output from when your computer started, run dmesg(8).  If it has
206 been replaced with other messages, look at /var/run/dmesg.boot.
207                 -- Francisco Reyes <lists@natserv.com>
208 %
209 You can use "whereis" to locate standard binary, manual page and source
210 directories for the specified programs. This can be particularly handy
211 when you are trying to find where in the pkgsrc tree an application is.
212
213 Try "whereis netscape" and "whereis whereis".
214                 -- Konstantinos Konstantinidis <kkonstan@duth.gr>
215 %
216 You can press Ctrl-D to quickly exit from a shell, or logout from a
217 login shell.
218                 -- Konstantinos Konstantinidis <kkonstan@duth.gr>
219 %
220 You can use "pkg_info" to see a list of packages you have installed.
221                 -- Konstantinos Konstantinidis <kkonstan@duth.gr>
222 %
223 You can change the video mode on all consoles by adding something like
224 the following to /etc/rc.conf:
225
226         allscreens="80x30"
227
228 You can use "vidcontrol -i mode | grep T" for a list of supported text
229 modes.
230                 -- Konstantinos Konstantinidis <kkonstan@duth.gr>
231 %
232 Any user that is a member of the wheel group can use "su -" to simulate
233 a root login. You can add a user to the wheel group by editing /etc/group.
234                 -- Konstantinos Konstantinidis <kkonstan@duth.gr>
235 %
236 Over quota?  "du -s * | sort -n " will give you a sorted list of your
237 directory sizes.
238                 -- David Scheidt <dscheidt@tumbolia.com>
239 %
240 Handy bash(1) prompt:   PS1="\u@\h \w \!$ "
241         -- David Scheidt <dscheidt@tumbolia.com>
242 %
243 Ever wonder what those numbers after command names were, as in cat(1)?  It's
244 the section of the manual the man page is in.  "man man" will tell you more.
245                 -- David Scheidt <dscheidt@tumbolia.com>
246 %
247 "man hier" explains the layout of DragonFly BSD filesystems.
248 %
249 "man tuning" has tips on how to improve DragonFly BSD performance.
250 %
251 "man firewall" has basic instructions for creating a DragonFly BSD firewall.
252 %
253 You can often get answers to your questions about DragonFly BSD by searching 
254 in the DragonFly BSD mailing list archives at
255
256         http://leaf.dragonflybsd.org/mailarchive/
257 %
258 You can adjust the volume of various parts of the sound system in your
259 computer by typing 'mixer <type> <volume>'.  To get a list of what you can
260 adjust, just type 'mixer'.
261 %
262 You can automatically download and install binary packages by doing
263
264         pkg_add <URL>
265
266 where you replace <URL> with the URL to the package.  This will also
267 automatically install the packages the package you download is dependent on
268 (ie, the packages it needs in order to work.)
269 %
270 You can make a log of your terminal session with script(1).
271 %
272 "man security" gives very good advice on how to tune the security of your
273 DragonFly BSD system.
274 %
275 Want to see how much virtual memory you're using? Just type "swapinfo" to
276 be shown information about the usage of your swap partitions.
277 %
278 pkgsrc/net/netcat package is useful not only for redirecting input/output
279 to TCP or UDP connections, but also for proxying them. See inetd(8) for
280 details.
281 %
282 If other operating systems have damaged your Master Boot Record, you can
283 reinstall it with boot0cfg(8). See "man boot0cfg" for details.
284 %
285 Need to see the calendar for this month? Simply type "cal".  To see the
286 whole year, type "cal -y".
287                 -- Dru <genesis@istar.ca>
288 %
289 Need to quickly return to your home directory? Type "cd".
290                 -- Dru <genesis@istar.ca>
291 %
292 To see the last time that you logged in, use lastlogin(8).
293                 -- Dru <genesis@istar.ca>
294 %
295 To clear the screen, use "clear". To re-display your screen buffer, press
296 the scroll lock key and use your page up button. When you're finished,
297 press the scroll lock key again to get your prompt back.
298                 -- Dru <genesis@istar.ca>
299 %
300 To save disk space in your home directory, compress files you rarely
301 use with "gzip filename".
302                 -- Dru <genesis@istar.ca>
303 %
304 To read a compressed file without having to first uncompress it, use
305 "zcat" or "zmore" to view it.
306                 -- Dru <genesis@istar.ca>
307 %
308 To see how much disk space is left on your partitions, use
309
310         df -h
311                 -- Dru <genesis@istar.ca>
312 %
313 To see the 10 largest files on a directory or partition, use
314
315         du /partition_or_directory_name | sort -rn | head
316                 -- Dru <genesis@istar.ca>
317 %
318 To determine whether a file is a text file, executable, or some other type
319 of file, use
320
321         file filename
322                 -- Dru <genesis@istar.ca>
323 %
324 Time to change your password? Type "passwd" and follow the prompts.
325                 -- Dru <genesis@istar.ca>
326 %
327 Want to know how many words, lines, or bytes are contained in a file? Type
328 "wc filename".
329                 -- Dru <genesis@istar.ca>
330 %
331 Need to print a manpage? Use
332
333         man name_of_manpage | col -bx | lpr
334                 -- Dru <genesis@istar.ca>
335 %
336 Need to remove all those ^M characters from a DOS file? Try
337
338         col -bx < dosfile > newfile
339                 -- Dru <genesis@istar.ca>
340 %
341 Forget what directory you are in? Type "pwd".
342                 -- Dru <genesis@istar.ca>
343 %
344 If you are in the C shell and have just installed a new program, you won't
345 be able to run it unless you first type "rehash".
346                 -- Dru <genesis@istar.ca>
347 %
348 Need to leave your terminal for a few minutes and don't want to logout?
349 Use "lock -p". When you return, use your password as the key to unlock the
350 terminal.
351                 -- Dru <genesis@istar.ca>
352 %
353 Need to find the location of a program? Use "locate program_name".
354                 -- Dru <genesis@istar.ca>
355 %
356 Forget how to spell a word or a variation of a word? Use
357
358         look portion_of_word_you_know
359                 -- Dru <genesis@istar.ca>
360 %
361 To see the last 10 lines of a long file, use "tail filename". To see the
362 first 10 lines, use "head filename".
363                 -- Dru <genesis@istar.ca>
364 %
365 To see how long it takes a command to run, type the word "time" before the
366 command name.
367                 -- Dru <genesis@istar.ca>
368 %
369 To quickly create an empty file, use "touch filename".
370                 -- Dru <genesis@istar.ca>
371 %
372 To find out the hostname associated with an IP address, use
373
374         dig -x IP_address
375                 -- Dru <genesis@istar.ca>
376 %
377 If you use the C shell, add the following line to the .cshrc file in your
378 home directory to prevent core files from being written to disk:
379
380         limit coredumpsize 0
381                 -- Dru <genesis@istar.ca>
382 %
383 If you need a reminder to leave your terminal, type "leave +hhmm" where
384 "hhmm" represents in how many hours and minutes you need to leave.
385                 -- Dru <genesis@istar.ca>
386 %
387 Need to do a search in a manpage or in a file you've sent to a pager? Use
388 "/search_word". To repeat the same search, type "n" for next.
389                 -- Dru <genesis@istar.ca>
390 %
391 Forget when Easter is? Try "ncal -e". If you need the date for Orthodox
392 Easter, use "ncal -o" instead.
393                 -- Dru <genesis@istar.ca>
394 %
395 Need to see your routing table? Type "netstat -rn". The entry with the G
396 flag is your gateway.
397                 -- Dru <genesis@istar.ca>
398 %
399 Need to see which daemons are listening for connection requests? Use
400 "sockstat -4l" for IPv4, and "sockstat -l" for IPv4 and IPv6.
401                 -- Dru <genesis@istar.ca>
402 %
403 Can't remember if you've installed a certain package or not? Try "pkg_info |
404 grep package_name".
405                 -- Dru <genesis@istar.ca>
406 %
407 Got some time to kill? Try typing "hangman".
408                 -- Dru <genesis@istar.ca>
409 %
410 To erase a line you've written at the command prompt, use "Ctrl-U".
411                 -- Dru <genesis@istar.ca>
412 %
413 To repeat the last command in the C shell, type "!!".
414                 -- Dru <genesis@istar.ca>
415 %
416 Need to quickly empty a file? Use "echo > filename".
417                 -- Dru <genesis@istar.ca>
418 %
419 To see all directories on a DragonFly BSD system, type
420
421         ls -R / | more
422 %
423 To see the IP addresses currently set on your active interfaces, type
424 "ifconfig -u".
425                 -- Dru <genesis@istar.ca>
426 %
427 To see the MAC addresses of the NICs on your system, type
428
429         ifconfig -a
430                 -- Dru <genesis@istar.ca>
431 %
432 You can save your kernel startup configuration with kget(8).  The
433 configuration can be edited at boot time with 'boot -c' command in loader.
434 See boot(8), loader(8) for details.
435 %
436 You can open up a new split-screen window in (n)vi with :N or :E and then
437 use ^w to switch between the two.
438 %
439 sh (the default bourne shell in DragonFly BSD) supports command-line editing.  
440 Just ``set -o emacs'' or ``set -o vi'' to enable it.
441 %
442 When you've made modifications to a file in vi(1) and then find that
443 you can't write it, type ``<ESC>!rm -f %'' then ``:w!'' to force the
444 write
445
446 This won't work if you don't have write permissions to the directory
447 and probably won't be suitable if you're editing through a symbolic link.
448 %
449 If you want to quickly check for duplicate package/port installations,
450 try the following pkg_info command.
451
452         pkg_info | sort | sed -e 's/-[0-9].*$//' | \
453         uniq -c | grep -v '^[[:space:]]*1'
454 %
455 Want to use sed(1) to edit a file in place?  Well, to replace every 'e' with
456 an 'o', in a file named 'foo', you can do:
457
458         sed -i.bak s/e/o/g foo
459
460 And you'll get a backup of the original in a file named 'foo.bak', but if you
461 want no backup:
462
463         sed -i '' s/e/o/g foo