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