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