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