16ae1554aSColin PercivalThis fortune brought to you by: 26ae1554aSColin Percival$FreeBSD$ 36ae1554aSColin Percival% 46ae1554aSColin PercivalAny user that is a member of the wheel group can use "su -" to simulate 56ae1554aSColin Percivala root login. You can add a user to the wheel group by editing /etc/group. 66ae1554aSColin Percival -- Konstantinos Konstantinidis <kkonstan@duth.gr> 76ae1554aSColin Percival% 86ae1554aSColin PercivalBy pressing "Scroll Lock" you can use the arrow keys to scroll backward 96ae1554aSColin Percivalthrough the console output. Press "Scroll Lock" again to turn it off. 10*1909a1f4SAlfred PerlsteinDon't have a "Scroll Lock" key? The "Pause / Break" key acts alike. 116ae1554aSColin Percival% 126ae1554aSColin PercivalCan't remember if you've installed a certain port or not? Try "pkg info 136ae1554aSColin Percival-x port_name". 146ae1554aSColin Percival% 156ae1554aSColin PercivalEver wonder what those numbers after command names were, as in cat(1)? It's 166ae1554aSColin Percivalthe section of the manual the man page is in. "man man" will tell you more. 176ae1554aSColin Percival -- David Scheidt <dscheidt@tumbolia.com> 186ae1554aSColin Percival% 196ae1554aSColin PercivalForget how to spell a word or a variation of a word? Use 206ae1554aSColin Percival 216ae1554aSColin Percival look portion_of_word_you_know 226ae1554aSColin Percival -- Dru <genesis@istar.ca> 236ae1554aSColin Percival% 246ae1554aSColin PercivalForget what directory you are in? Type "pwd". 256ae1554aSColin Percival -- Dru <genesis@istar.ca> 266ae1554aSColin Percival% 276ae1554aSColin PercivalForget when Easter is? Try "ncal -e". If you need the date for Orthodox 286ae1554aSColin PercivalEaster, use "ncal -o" instead. 296ae1554aSColin Percival -- Dru <genesis@istar.ca> 306ae1554aSColin Percival% 316ae1554aSColin PercivalFreeBSD is started up by the program 'init'. The first thing init does when 326ae1554aSColin Percivalstarting multiuser mode (ie, starting the computer up for normal use) is to 336ae1554aSColin Percivalrun the shell script /etc/rc. By reading /etc/rc and the /etc/rc.d/ scripts, 346ae1554aSColin Percivalyou can learn a lot about how the system is put together, which again will 356ae1554aSColin Percivalmake you more confident about what happens when you do something with it. 366ae1554aSColin Percival% 376ae1554aSColin PercivalHandy bash(1) prompt: PS1="\u@\h \w \!$ " 386ae1554aSColin Percival -- David Scheidt <dscheidt@tumbolia.com> 396ae1554aSColin Percival% 406ae1554aSColin PercivalHaving trouble using fetch through a firewall? Try setting the environment 416ae1554aSColin Percivalvariable FTP_PASSIVE_MODE to yes, and see fetch(3) for more details. 426ae1554aSColin Percival% 436ae1554aSColin PercivalIf other operating systems have damaged your Master Boot Record, you can 44*1909a1f4SAlfred Perlsteinreinstall it with gpart(8). See 45*1909a1f4SAlfred Perlstein"man gpart" for details. 466ae1554aSColin Percival% 476ae1554aSColin PercivalIf you accidentally end up inside vi, you can quit it by pressing Escape, colon 486ae1554aSColin Percival(:), q (q), bang (!) and pressing return. 496ae1554aSColin Percival% 506ae1554aSColin PercivalIf you are in the C shell and have just installed a new program, you won't 516ae1554aSColin Percivalbe able to run it unless you first type "rehash". 526ae1554aSColin Percival -- Dru <genesis@istar.ca> 536ae1554aSColin Percival% 546ae1554aSColin PercivalIf you do not want to get beeps in X11 (X Windows), you can turn them off with 556ae1554aSColin Percival 566ae1554aSColin Percival xset b off 576ae1554aSColin Percival% 586ae1554aSColin PercivalIf you have a CD-ROM drive in your machine, you can make the CD-ROM that is 596ae1554aSColin Percivalpresently inserted available by typing 'mount /cdrom' as root. The CD-ROM 606ae1554aSColin Percivalwill be available under /cdrom/. Remember to do 'umount /cdrom' before 616ae1554aSColin Percivalremoving the CD-ROM (it will usually not be possible to remove the CD-ROM 626ae1554aSColin Percivalwithout doing this.) 636ae1554aSColin Percival 646ae1554aSColin PercivalNote: This tip may not work in all configurations. 656ae1554aSColin Percival% 666ae1554aSColin PercivalIf you need a reminder to leave your terminal, type "leave +hhmm" where 676ae1554aSColin Percival"hhmm" represents in how many hours and minutes you need to leave. 686ae1554aSColin Percival -- Dru <genesis@istar.ca> 696ae1554aSColin Percival% 706ae1554aSColin PercivalIf you need to ask a question on the FreeBSD-questions mailing list then 716ae1554aSColin Percival 726ae1554aSColin Percival http://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/\ 736ae1554aSColin Percival freebsd-questions/index.html 746ae1554aSColin Percival 756ae1554aSColin Percivalcontains lots of useful advice to help you get the best results. 766ae1554aSColin Percival% 776ae1554aSColin PercivalIf you write part of a filename in tcsh, 786ae1554aSColin Percivalpressing TAB will show you the available choices when there 796ae1554aSColin Percivalis more than one, or complete the filename if there's only one match. 806ae1554aSColin Percival% 816ae1554aSColin PercivalIf you `set watch = (0 any any)' in tcsh, you will be notified when 826ae1554aSColin Percivalsomeone logs in or out of your system. 836ae1554aSColin Percival% 846ae1554aSColin PercivalIf you use the C shell, add the following line to the .cshrc file in your 856ae1554aSColin Percivalhome directory to prevent core files from being written to disk: 866ae1554aSColin Percival 876ae1554aSColin Percival limit coredumpsize 0 886ae1554aSColin Percival -- Dru <genesis@istar.ca> 896ae1554aSColin Percival% 906ae1554aSColin PercivalIf you want df(1) and other commands to display disk sizes in 916ae1554aSColin Percivalkilobytes instead of 512-byte blocks, set BLOCKSIZE in your 926ae1554aSColin Percivalenvironment to 'K'. You can also use 'M' for Megabytes or 'G' for 936ae1554aSColin PercivalGigabytes. If you want df(1) to automatically select the best size 946ae1554aSColin Percivalthen use 'df -h'. 956ae1554aSColin Percival% 966ae1554aSColin PercivalIf you want to play CDs with FreeBSD, a utility for this is already included. 976ae1554aSColin PercivalType 'cdcontrol' then 'help' to learn more. (You may need to set the CDROM 986ae1554aSColin Percivalenvironment variable in order to make cdcontrol want to start.) 996ae1554aSColin Percival% 1006ae1554aSColin PercivalIf you'd like to keep track of applications in the FreeBSD ports tree, take a 1016ae1554aSColin Percivallook at FreshPorts; 1026ae1554aSColin Percival 1036ae1554aSColin Percival http://www.freshports.org/ 1046ae1554aSColin Percival% 1056ae1554aSColin PercivalIn order to make fetch (the FreeBSD downloading tool) ask for 1066ae1554aSColin Percivalusername/password when it encounters a password-protected web page, you can set 1076ae1554aSColin Percivalthe environment variable HTTP_AUTH to 'basic:*'. 1086ae1554aSColin Percival% 1096ae1554aSColin PercivalIn order to search for a string in some files, use 'grep' like this: 1106ae1554aSColin Percival 1116ae1554aSColin Percival grep "string" filename1 [filename2 filename3 ...] 1126ae1554aSColin Percival 1136ae1554aSColin PercivalThis will print out the lines in the files that contain the string. grep can 1146ae1554aSColin Percivalalso do a lot more advanced searches - type 'man grep' for details. 1156ae1554aSColin Percival% 1166ae1554aSColin PercivalIn order to support national characters for European languages in tools like 1176ae1554aSColin Percivalless without creating other nationalisation aspects, set the environment 1186ae1554aSColin Percivalvariable LC_ALL to 'en_US.ISO8859-1'. 1196ae1554aSColin Percival% 120*1909a1f4SAlfred Perlstein"man firewall" will give advice for building a FreeBSD firewall using ipfw(8). 1216ae1554aSColin Percival -- David Scheidt <dscheidt@tumbolia.com> 1226ae1554aSColin Percival% 1236ae1554aSColin Percival"man hier" will explain the way FreeBSD filesystems are normally laid out. 1246ae1554aSColin Percival -- David Scheidt <dscheidt@tumbolia.com> 1256ae1554aSColin Percival% 1266ae1554aSColin PercivalMan pages are divided into section depending on topic. There are 9 different 1276ae1554aSColin Percivalsections numbered from 1 (General Commands) to 9 (Kernel Developer's Manual). 1286ae1554aSColin PercivalYou can get an introduction to each topic by typing 1296ae1554aSColin Percival 1306ae1554aSColin Percival man <number> intro 1316ae1554aSColin Percival 1326ae1554aSColin PercivalIn other words, to get the intro to general commands, type 1336ae1554aSColin Percival 1346ae1554aSColin Percival man 1 intro 1356ae1554aSColin Percival% 1366ae1554aSColin Percival"man ports" gives many useful hints about installing FreeBSD ports. 1376ae1554aSColin Percival% 1386ae1554aSColin Percival"man security" gives very good advice on how to tune the security of your 1396ae1554aSColin PercivalFreeBSD system. 1406ae1554aSColin Percival% 1416ae1554aSColin Percival"man tuning" gives some tips how to tune performance of your FreeBSD system. 1426ae1554aSColin Percival -- David Scheidt <dscheidt@tumbolia.com> 1436ae1554aSColin Percival% 1446ae1554aSColin PercivalNeed to do a search in a manpage or in a file you've sent to a pager? Use 145*1909a1f4SAlfred Perlstein"/search_word". To repeat the same search, type "n" for next or "p" for 146*1909a1f4SAlfred Perlsteinprevious. 1476ae1554aSColin Percival -- Dru <genesis@istar.ca> 1486ae1554aSColin Percival% 1496ae1554aSColin PercivalNeed to find the location of a program? Use "locate program_name". 1506ae1554aSColin Percival -- Dru <genesis@istar.ca> 1516ae1554aSColin Percival% 1526ae1554aSColin PercivalNeed to leave your terminal for a few minutes and don't want to logout? 1536ae1554aSColin PercivalUse "lock -p". When you return, use your password as the key to unlock the 1546ae1554aSColin Percivalterminal. 1556ae1554aSColin Percival -- Dru <genesis@istar.ca> 1566ae1554aSColin Percival% 1576ae1554aSColin PercivalNeed to print a manpage? Use 1586ae1554aSColin Percival 1596ae1554aSColin Percival man name_of_manpage | col -bx | lpr 1606ae1554aSColin Percival -- Dru <genesis@istar.ca> 1616ae1554aSColin Percival% 1626ae1554aSColin PercivalNeed to quickly empty a file? Use ": > filename". 1636ae1554aSColin Percival -- Dru <genesis@istar.ca> 1646ae1554aSColin Percival% 1656ae1554aSColin PercivalNeed to quickly return to your home directory? Type "cd". 1666ae1554aSColin Percival -- Dru <genesis@istar.ca> 1676ae1554aSColin Percival% 1686ae1554aSColin PercivalNeed to remove all those ^M characters from a DOS file? Try 1696ae1554aSColin Percival 1706ae1554aSColin Percival tr -d \\r < dosfile > newfile 1716ae1554aSColin Percival -- Originally by Dru <genesis@istar.ca> 1726ae1554aSColin Percival% 1736ae1554aSColin PercivalNeed to see the calendar for this month? Simply type "cal". To see the 1746ae1554aSColin Percivalwhole year, type "cal -y". 1756ae1554aSColin Percival -- Dru <genesis@istar.ca> 1766ae1554aSColin Percival% 1776ae1554aSColin PercivalNeed to see which daemons are listening for connection requests? Use 1786ae1554aSColin Percival"sockstat -4l" for IPv4, and "sockstat -l" for IPv4 and IPv6. 1796ae1554aSColin Percival -- Dru <genesis@istar.ca> 1806ae1554aSColin Percival% 1816ae1554aSColin PercivalNeed to see your routing table? Type "netstat -rn". The entry with the G 1826ae1554aSColin Percivalflag is your gateway. 1836ae1554aSColin Percival -- Dru <genesis@istar.ca> 1846ae1554aSColin Percival% 1856ae1554aSColin PercivalNice bash prompt: PS1='(\[$(tput md)\]\t <\w>\[$(tput me)\]) $(echo $?) \$ ' 1866ae1554aSColin Percival -- Mathieu <mathieu@hal.interactionvirtuelle.com> 1876ae1554aSColin Percival% 188*1909a1f4SAlfred PerlsteinOver quota? "du -sh * | sort -h " will give you a sorted list of your 1896ae1554aSColin Percivaldirectory sizes. 1906ae1554aSColin Percival -- David Scheidt <dscheidt@tumbolia.com> 1916ae1554aSColin Percival% 1926ae1554aSColin Percivalnc(1) (or netcat) is useful not only for redirecting input/output to 1936ae1554aSColin PercivalTCP or UDP connections, but also for proxying them with inetd(8). 1946ae1554aSColin Percival% 1956ae1554aSColin Percivalsh (the default Bourne shell in FreeBSD) supports command-line editing. Just 196*1909a1f4SAlfred Perlstein``set -o emacs'' or ``set -o vi'' to enable it. Use "<TAB>" key to complete 197*1909a1f4SAlfred Perlsteinpaths. 1986ae1554aSColin Percival% 1996ae1554aSColin PercivalSimple tcsh prompt: set prompt = '%# ' 2006ae1554aSColin Percival% 2016ae1554aSColin PercivalThe default editor in FreeBSD is vi, which is efficient to use when you have 2026ae1554aSColin Percivallearned it, but somewhat user-unfriendly. To use ee (an easier but less 2036ae1554aSColin Percivalpowerful editor) instead, set the environment variable EDITOR to /usr/bin/ee 2046ae1554aSColin Percival% 2056ae1554aSColin PercivalTime to change your password? Type "passwd" and follow the prompts. 2066ae1554aSColin Percival -- Dru <genesis@istar.ca> 2076ae1554aSColin Percival% 2086ae1554aSColin PercivalTo change an environment variable in /bin/sh use: 2096ae1554aSColin Percival 2106ae1554aSColin Percival $ VARIABLE="value" 2116ae1554aSColin Percival $ export VARIABLE 2126ae1554aSColin Percival% 2136ae1554aSColin PercivalTo change an environment variable in tcsh you use: setenv NAME "value" 2146ae1554aSColin Percivalwhere NAME is the name of the variable and "value" its new value. 2156ae1554aSColin Percival% 2166ae1554aSColin PercivalTo clear the screen, use "clear". To re-display your screen buffer, press 2176ae1554aSColin Percivalthe scroll lock key and use your page up button. When you're finished, 2186ae1554aSColin Percivalpress the scroll lock key again to get your prompt back. 2196ae1554aSColin Percival -- Dru <genesis@istar.ca> 2206ae1554aSColin Percival% 221*1909a1f4SAlfred PerlsteinYou can press Ctrl-L while in the shell to clear the screen. 222*1909a1f4SAlfred Perlstein% 2236ae1554aSColin PercivalTo determine whether a file is a text file, executable, or some other type 2246ae1554aSColin Percivalof file, use 2256ae1554aSColin Percival 2266ae1554aSColin Percival file filename 2276ae1554aSColin Percival -- Dru <genesis@istar.ca> 2286ae1554aSColin Percival% 2296ae1554aSColin PercivalTo do a fast search for a file, try 2306ae1554aSColin Percival 2316ae1554aSColin Percival locate filename 2326ae1554aSColin Percival 2336ae1554aSColin Percivallocate uses a database that is updated every Saturday (assuming your computer 2346ae1554aSColin Percivalis running FreeBSD at the time) to quickly find files based on name only. 2356ae1554aSColin Percival% 2366ae1554aSColin PercivalTo erase a line you've written at the command prompt, use "Ctrl-U". 2376ae1554aSColin Percival -- Dru <genesis@istar.ca> 2386ae1554aSColin Percival% 239*1909a1f4SAlfred PerlsteinTo find out the hostname associated with an IP address, use 2406ae1554aSColin Percival 2416ae1554aSColin Percival drill -x IP_address 242*1909a1f4SAlfred Perlstein -- Dru <genesis@istar.ca> 2436ae1554aSColin Percival% 2446ae1554aSColin PercivalTo obtain a neat PostScript rendering of a manual page, use ``-t'' switch 2456ae1554aSColin Percivalof the man(1) utility: ``man -t <topic>''. For example: 2466ae1554aSColin Percival 2476ae1554aSColin Percival man -t grep > grep.ps # Save the PostScript version to a file 2486ae1554aSColin Percivalor 2496ae1554aSColin Percival man -t printf | lp # Send the PostScript directly to printer 2506ae1554aSColin Percival% 2516ae1554aSColin PercivalTo quickly create an empty file, use "touch filename". 2526ae1554aSColin Percival -- Dru <genesis@istar.ca> 2536ae1554aSColin Percival% 2546ae1554aSColin PercivalTo read a compressed file without having to first uncompress it, use 255*1909a1f4SAlfred Perlstein"zcat" or "zless" to view it. There is also "bzcat", "bzless", "xzcat" 256*1909a1f4SAlfred Perlsteinand "xzless". 2576ae1554aSColin Percival -- Dru <genesis@istar.ca> 2586ae1554aSColin Percival% 2596ae1554aSColin PercivalTo repeat the last command in the C shell, type "!!". 2606ae1554aSColin Percival -- Dru <genesis@istar.ca> 2616ae1554aSColin Percival% 2626ae1554aSColin PercivalTo save disk space in your home directory, compress files you rarely 2636ae1554aSColin Percivaluse with "gzip filename". 2646ae1554aSColin Percival -- Dru <genesis@istar.ca> 2656ae1554aSColin Percival% 2666ae1554aSColin PercivalTo search for files that match a particular name, use find(1); for example 2676ae1554aSColin Percival 2686ae1554aSColin Percival find / -name "*GENERIC*" -ls 2696ae1554aSColin Percival 2706ae1554aSColin Percivalwill search '/', and all subdirectories, for files with 'GENERIC' in the name. 2716ae1554aSColin Percival -- Stephen Hilton <nospam@hiltonbsd.com> 2726ae1554aSColin Percival% 2736ae1554aSColin PercivalTo see all of the directories on your FreeBSD system, type 2746ae1554aSColin Percival 2756ae1554aSColin Percival find / -type d | less 2766ae1554aSColin Percival 2776ae1554aSColin PercivalAll the files? 2786ae1554aSColin Percival 2796ae1554aSColin Percival find / -type f | less 2806ae1554aSColin Percival% 2816ae1554aSColin PercivalTo see how long it takes a command to run, type the word "time" before the 2826ae1554aSColin Percivalcommand name. 2836ae1554aSColin Percival -- Dru <genesis@istar.ca> 2846ae1554aSColin Percival% 2856ae1554aSColin PercivalTo see how much disk space is left on your partitions, use 2866ae1554aSColin Percival 2876ae1554aSColin Percival df -h 2886ae1554aSColin Percival -- Dru <genesis@istar.ca> 2896ae1554aSColin Percival% 2906ae1554aSColin PercivalTo see the 10 largest files on a directory or partition, use 2916ae1554aSColin Percival 292*1909a1f4SAlfred Perlstein du -h /partition_or_directory_name | sort -rh | head 2936ae1554aSColin Percival -- Dru <genesis@istar.ca> 2946ae1554aSColin Percival% 2956ae1554aSColin PercivalTo see the IP addresses currently set on your active interfaces, type 2966ae1554aSColin Percival"ifconfig -u". 2976ae1554aSColin Percival -- Dru <genesis@istar.ca> 2986ae1554aSColin Percival% 2996ae1554aSColin PercivalTo see the last 10 lines of a long file, use "tail filename". To see the 300*1909a1f4SAlfred Perlsteinfirst 10 lines, use "head filename". To see new lines as they're appended 301*1909a1f4SAlfred Perlsteinto a file, use "tail -f filename". 3026ae1554aSColin Percival -- Dru <genesis@istar.ca> 3036ae1554aSColin Percival% 3046ae1554aSColin PercivalTo see the last time that you logged in, use lastlogin(8). 3056ae1554aSColin Percival -- Dru <genesis@istar.ca> 3066ae1554aSColin Percival% 3076ae1554aSColin PercivalTo see the MAC addresses of the NICs on your system, type 3086ae1554aSColin Percival 3096ae1554aSColin Percival ifconfig -a 3106ae1554aSColin Percival -- Dru <genesis@istar.ca> 3116ae1554aSColin Percival% 3126ae1554aSColin PercivalTo see the output from when your computer started, run dmesg(8). If it has 3136ae1554aSColin Percivalbeen replaced with other messages, look at /var/run/dmesg.boot. 3146ae1554aSColin Percival -- Francisco Reyes <lists@natserv.com> 3156ae1554aSColin Percival% 3166ae1554aSColin PercivalWant colour in your directory listings? Use "ls -G". "ls -F" is also useful, 3176ae1554aSColin Percivaland they can be combined as "ls -FG". 3186ae1554aSColin Percival% 3196ae1554aSColin PercivalWant to find a specific port, just type the following under /usr/ports 3206ae1554aSColin Percivalor one its subdirectories: 3216ae1554aSColin Percival 3226ae1554aSColin Percival make search name=<port-name> 3236ae1554aSColin Percival or 3246ae1554aSColin Percival make search key=<keyword> 3256ae1554aSColin Percival% 3266ae1554aSColin PercivalWant to know how many words, lines, or bytes are contained in a file? Type 3276ae1554aSColin Percival"wc filename". 3286ae1554aSColin Percival -- Dru <genesis@istar.ca> 3296ae1554aSColin Percival% 3306ae1554aSColin PercivalWant to see how much virtual memory you're using? Just type "swapinfo" to 3316ae1554aSColin Percivalbe shown information about the usage of your swap partitions. 3326ae1554aSColin Percival% 3336ae1554aSColin PercivalWant to strip UTF-8 BOM(Byte Order Mark) from given files? 3346ae1554aSColin Percival 3356ae1554aSColin Percival sed -e '1s/^\xef\xbb\xbf//' < bomfile > newfile 3366ae1554aSColin Percival% 3376ae1554aSColin PercivalWant to use sed(1) to edit a file in place? Well, to replace every 'e' with 3386ae1554aSColin Percivalan 'o', in a file named 'foo', you can do: 3396ae1554aSColin Percival 3406ae1554aSColin Percival sed -i.bak s/e/o/g foo 3416ae1554aSColin Percival 3426ae1554aSColin PercivalAnd you'll get a backup of the original in a file named 'foo.bak', but if you 3436ae1554aSColin Percivalwant no backup: 3446ae1554aSColin Percival 3456ae1554aSColin Percival sed -i '' s/e/o/g foo 3466ae1554aSColin Percival% 3476ae1554aSColin PercivalWhen you've made modifications to a file in vi(1) and then find that 3486ae1554aSColin Percivalyou can't write it, type ``<ESC>!rm -f %'' then ``:w!'' to force the 3496ae1554aSColin Percivalwrite 3506ae1554aSColin Percival 3516ae1554aSColin PercivalThis won't work if you don't have write permissions to the directory 3526ae1554aSColin Percivaland probably won't be suitable if you're editing through a symbolic link. 353*1909a1f4SAlfred Perlstein 354*1909a1f4SAlfred PerlsteinIf you have sudo(8) installed and permissions to use it, type 355*1909a1f4SAlfred Perlstein``<ESC>w ! sudo tee %'' to force a write. 3566ae1554aSColin Percival% 3576ae1554aSColin PercivalYou can adjust the volume of various parts of the sound system in your 3586ae1554aSColin Percivalcomputer by typing 'mixer <type> <volume>'. To get a list of what you can 3596ae1554aSColin Percivaladjust, just type 'mixer'. 3606ae1554aSColin Percival% 3616ae1554aSColin PercivalYou can automatically download and install binary packages by doing 3626ae1554aSColin Percival 3636ae1554aSColin Percival pkg install <package> 3646ae1554aSColin Percival 3656ae1554aSColin PercivalThis will also automatically install the packages that are dependencies 3666ae1554aSColin Percivalfor the package you install (ie, the packages it needs in order to work.) 3676ae1554aSColin Percival% 3686ae1554aSColin PercivalYou can change the video mode on all consoles by adding something like 3696ae1554aSColin Percivalthe following to /etc/rc.conf: 3706ae1554aSColin Percival 3716ae1554aSColin Percival allscreens="80x30" 3726ae1554aSColin Percival 3736ae1554aSColin PercivalYou can use "vidcontrol -i mode | grep T" for a list of supported text 3746ae1554aSColin Percivalmodes. 3756ae1554aSColin Percival -- Konstantinos Konstantinidis <kkonstan@duth.gr> 3766ae1554aSColin Percival% 3776ae1554aSColin PercivalYou can disable tcsh's terminal beep if you `set nobeep'. 3786ae1554aSColin Percival% 3796ae1554aSColin PercivalYou can install extra packages for FreeBSD by using the ports system. 3806ae1554aSColin PercivalIf you have installed it, you can download, compile, and install software by 3816ae1554aSColin Percivaljust typing 3826ae1554aSColin Percival 3836ae1554aSColin Percival # cd /usr/ports/<category>/<portname> 3846ae1554aSColin Percival # make install && make clean 3856ae1554aSColin Percival 3866ae1554aSColin Percivalas root. The ports infrastructure will download the software, change it so 3876ae1554aSColin Percivalit works on FreeBSD, compile it, install it, register the installation so it 3886ae1554aSColin Percivalwill be possible to automatically uninstall it, and clean out the temporary 3896ae1554aSColin Percivalworking space it used. You can remove an installed port you decide you do not 3906ae1554aSColin Percivalwant after all by typing 3916ae1554aSColin Percival 3926ae1554aSColin Percival # cd /usr/ports/<category>/<portname> 3936ae1554aSColin Percival # make deinstall 3946ae1554aSColin Percival 3956ae1554aSColin Percivalas root. 3966ae1554aSColin Percival% 3976ae1554aSColin PercivalYou can look through a file in a nice text-based interface by typing 3986ae1554aSColin Percival 3996ae1554aSColin Percival less filename 4006ae1554aSColin Percival% 4016ae1554aSColin PercivalYou can make a log of your terminal session with script(1). 4026ae1554aSColin Percival% 4036ae1554aSColin PercivalYou can often get answers to your questions about FreeBSD by searching in the 4046ae1554aSColin PercivalFreeBSD mailing list archives at 4056ae1554aSColin Percival 406*1909a1f4SAlfred Perlstein http://freebsd.markmail.org 4076ae1554aSColin Percival% 4086ae1554aSColin PercivalYou can open up a new split-screen window in (n)vi with :N or :E and then 4096ae1554aSColin Percivaluse ^w to switch between the two. 4106ae1554aSColin Percival% 4116ae1554aSColin PercivalYou can permanently set environment variables for your shell by putting them 4126ae1554aSColin Percivalin a startup file for the shell. The name of the startup file varies 4136ae1554aSColin Percivaldepending on the shell - csh and tcsh uses .login, bash, sh, ksh and zsh use 4146ae1554aSColin Percival.profile. When using bash, sh, ksh or zsh, don't forget to export the 4156ae1554aSColin Percivalvariable. 4166ae1554aSColin Percival% 4176ae1554aSColin PercivalYou can press Ctrl-D to quickly exit from a shell, or logout from a 4186ae1554aSColin Percivallogin shell. 4196ae1554aSColin Percival -- Konstantinos Konstantinidis <kkonstan@duth.gr> 4206ae1554aSColin Percival% 4216ae1554aSColin PercivalYou can press up-arrow or down-arrow to walk through a list of 4226ae1554aSColin Percivalprevious commands in tcsh. 4236ae1554aSColin Percival% 4246ae1554aSColin PercivalYou can search for documentation on a keyword by typing 4256ae1554aSColin Percival 4266ae1554aSColin Percival apropos keyword 4276ae1554aSColin Percival% 4286ae1554aSColin PercivalYou can `set autologout = 30' to have tcsh log you off automatically 4296ae1554aSColin Percivalif you leave the shell idle for more than 30 minutes. 4306ae1554aSColin Percival% 4316ae1554aSColin PercivalYou can use aliases to decrease the amount of typing you need to do to get 4326ae1554aSColin Percivalcommands you commonly use. Examples of fairly popular aliases include (in 4336ae1554aSColin PercivalBourne shell style, as in /bin/sh, bash, ksh, and zsh): 4346ae1554aSColin Percival 4356ae1554aSColin Percival alias lf="ls -FA" 4366ae1554aSColin Percival alias ll="ls -lA" 4376ae1554aSColin Percival alias su="su -m" 4386ae1554aSColin Percival 4396ae1554aSColin PercivalIn csh or tcsh, these would be 4406ae1554aSColin Percival 4416ae1554aSColin Percival alias lf ls -FA 4426ae1554aSColin Percival alias ll ls -lA 4436ae1554aSColin Percival alias su su -m 4446ae1554aSColin Percival 4456ae1554aSColin PercivalTo remove an alias, you can usually use 'unalias aliasname'. To list all 4466ae1554aSColin Percivalaliases, you can usually type just 'alias'. 4476ae1554aSColin Percival% 4486ae1554aSColin PercivalYou can use /etc/make.conf to control the options used to compile software 4496ae1554aSColin Percivalon this system. Example entries are in 450*1909a1f4SAlfred Perlstein/usr/share/examples/etc/make.conf and in make.conf(5). 451*1909a1f4SAlfred PerlsteinFor options that are set for building FreeBSD's kernel and its world, see 452*1909a1f4SAlfred Perlsteinsrc.conf(5). 4536ae1554aSColin Percival% 4546ae1554aSColin PercivalYou can use "pkg info" to see a list of packages you have installed. 4556ae1554aSColin Percival% 4566ae1554aSColin PercivalYou can use the 'fetch' command to retrieve files over ftp, http or https. 4576ae1554aSColin Percival 4586ae1554aSColin Percival fetch http://www.FreeBSD.org/index.html 4596ae1554aSColin Percival 4606ae1554aSColin Percivalwill download the front page of the FreeBSD web site. 4616ae1554aSColin Percival% 4626ae1554aSColin PercivalYou can use "whereis" to search standard binary, manual page and source 4636ae1554aSColin Percivaldirectories for the specified programs. This can be particularly handy 4646ae1554aSColin Percivalwhen you are trying to find where in the ports tree an application is. 4656ae1554aSColin Percival 4666ae1554aSColin PercivalTry "whereis firefox" and "whereis whereis". 4676ae1554aSColin Percival -- Konstantinos Konstantinidis <kkonstan@duth.gr> 4686ae1554aSColin Percival% 4696ae1554aSColin PercivalWant to run the same command again? 470*1909a1f4SAlfred PerlsteinIn tcsh you can type "!!". 4716ae1554aSColin Percival% 4726ae1554aSColin PercivalWant to go the directory you were just in? 4736ae1554aSColin PercivalType "cd -" 4746ae1554aSColin Percival% 475*1909a1f4SAlfred PerlsteinCan't delete /usr/obj? Enter "chflags -R noschg /usr/obj" to remove the 476*1909a1f4SAlfred Perlsteinsystem immutable flag for all files in /usr/obj. 477*1909a1f4SAlfred Perlstein 478*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 479*1909a1f4SAlfred Perlstein% 480*1909a1f4SAlfred PerlsteinWant to list all files of an installed package? Enter 481*1909a1f4SAlfred Perlstein"pkg info -l packagename". 482*1909a1f4SAlfred Perlstein 483*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 484*1909a1f4SAlfred Perlstein% 485*1909a1f4SAlfred PerlsteinAre you looking for a package? Search for it with 486*1909a1f4SAlfred Perlstein"pkg search part_of_package_name" 487*1909a1f4SAlfred Perlstein 488*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 489*1909a1f4SAlfred Perlstein% 490*1909a1f4SAlfred PerlsteinIf you want to recursively copy a directory preserving file and directory 491*1909a1f4SAlfred Perlsteinattributes use 492*1909a1f4SAlfred Perlstein"cp -a source target" 493*1909a1f4SAlfred Perlstein 494*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 495*1909a1f4SAlfred Perlstein% 496*1909a1f4SAlfred PerlsteinDo you wonder what a terminal program is doing at the moment? dd(1) does not 497*1909a1f4SAlfred Perlsteinshow any troughput? Hit "^T" (Control + t) to send SIGINFO to the process 498*1909a1f4SAlfred Perlsteinand see what it is doing. 499*1909a1f4SAlfred Perlstein 500*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 501*1909a1f4SAlfred Perlstein% 502*1909a1f4SAlfred PerlsteinDo you want to know which version of FreeBSD you are running? Enter 503*1909a1f4SAlfred Perlstein"freebsd-version -ku" to display kernel and userland version. 504*1909a1f4SAlfred Perlstein 505*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 506*1909a1f4SAlfred Perlstein% 507*1909a1f4SAlfred PerlsteinIf you want to end one or more processes at a time using a regular expression 508*1909a1f4SAlfred Perlsteinenter "pkill regex". 509*1909a1f4SAlfred Perlstein 510*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 511*1909a1f4SAlfred Perlstein% 512*1909a1f4SAlfred PerlsteinDo you want to run a program directly after some other process has ended? Use 513*1909a1f4SAlfred Perlstein"pwait pid && new_program" 514*1909a1f4SAlfred Perlstein 515*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 516*1909a1f4SAlfred Perlstein% 517*1909a1f4SAlfred PerlsteinWhen you want your users to be able to reboot or shutdown FreeBSD, add them 518*1909a1f4SAlfred Perlsteinto the group "operator" and they are allowed to use shutdown(8) and poweroff(8). 519*1909a1f4SAlfred Perlstein 520*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 521*1909a1f4SAlfred Perlstein% 522*1909a1f4SAlfred PerlsteinIf you need to create a FAT32 formatted USB thumb drive, find out its devicename 523*1909a1f4SAlfred Perlsteinrunning dmesg(8) after inserting it. Then create an MBR schema, a single slice and 524*1909a1f4SAlfred Perlsteinformat it: 525*1909a1f4SAlfred Perlstein 526*1909a1f4SAlfred Perlstein# gpart create -s MBR ${devicename} 527*1909a1f4SAlfred Perlstein# gpart add -t fat32 ${devicename} 528*1909a1f4SAlfred Perlstein# newfs_msdos -F 32 -L thumbdrive ${devicename}s1 529*1909a1f4SAlfred Perlstein 530*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 531*1909a1f4SAlfred Perlstein% 532*1909a1f4SAlfred PerlsteinIf you want to get a sorted list of all services that are started when FreeBSD boots, 533*1909a1f4SAlfred Perlsteinenter "service -e". 534*1909a1f4SAlfred Perlstein 535*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 536*1909a1f4SAlfred Perlstein% 537*1909a1f4SAlfred PerlsteinTo easily configure your installed FreeBSD use bsdconfig(8). 538*1909a1f4SAlfred Perlstein 539*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 540*1909a1f4SAlfred Perlstein% 541*1909a1f4SAlfred PerlsteinAfter you compiled and installed a new version of FreeBSD, use etcupdate(8) to merge 542*1909a1f4SAlfred Perlsteinconfiguration updates. 543*1909a1f4SAlfred PerlsteinRun "etcupdate extract" once when your sources match your running system, then run 544*1909a1f4SAlfred Perlstein"etcupdate" after every upgrade and "etcupdate resolve" to resolve any conflicts. 545*1909a1f4SAlfred Perlstein 546*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 547*1909a1f4SAlfred Perlstein% 548*1909a1f4SAlfred PerlsteinDo you want to do a binary upgrade of your running FreeBSD installation? Use freebsd-update(8). 549*1909a1f4SAlfred Perlstein 550*1909a1f4SAlfred PerlsteinTo install updates and patches for the running branch use 551*1909a1f4SAlfred Perlstein# freebsd-update fetch install 552*1909a1f4SAlfred Perlstein 553*1909a1f4SAlfred PerlsteinTo upgrade to a newer release use 554*1909a1f4SAlfred Perlstein# freebsd-update upgrade -r ${name_of_release} 555*1909a1f4SAlfred Perlstein 556*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 557*1909a1f4SAlfred Perlstein% 558*1909a1f4SAlfred PerlsteinTo run rc scripts in /etc/rc.d and /usr/local/etc/rc.d use service(8). 559*1909a1f4SAlfred PerlsteinRun "service ${name_of_rc_script} start" to start a daemon and 560*1909a1f4SAlfred Perlstein"service ${name_of_rc_script} stop" to stop it. 561*1909a1f4SAlfred Perlstein 562*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 563*1909a1f4SAlfred Perlstein% 564*1909a1f4SAlfred PerlsteinIf you don't want to edit /etc/rc.conf directly, use sysrc(8) to add and remove entries. 565*1909a1f4SAlfred PerlsteinUse "sysrc name=value" to add an entry and "sysrc -x name" to delete an entry. 566*1909a1f4SAlfred Perlstein 567*1909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 568*1909a1f4SAlfred Perlstein% 569