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. 101909a1f4SAlfred 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 441909a1f4SAlfred Perlsteinreinstall it with gpart(8). See 451909a1f4SAlfred 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 do not want to get beeps in X11 (X Windows), you can turn them off with 516ae1554aSColin Percival 526ae1554aSColin Percival xset b off 536ae1554aSColin Percival% 546ae1554aSColin PercivalIf you have a CD-ROM drive in your machine, you can make the CD-ROM that is 556ae1554aSColin Percivalpresently inserted available by typing 'mount /cdrom' as root. The CD-ROM 566ae1554aSColin Percivalwill be available under /cdrom/. Remember to do 'umount /cdrom' before 576ae1554aSColin Percivalremoving the CD-ROM (it will usually not be possible to remove the CD-ROM 586ae1554aSColin Percivalwithout doing this.) 596ae1554aSColin Percival 606ae1554aSColin PercivalNote: This tip may not work in all configurations. 616ae1554aSColin Percival% 626ae1554aSColin PercivalIf you need a reminder to leave your terminal, type "leave +hhmm" where 636ae1554aSColin Percival"hhmm" represents in how many hours and minutes you need to leave. 646ae1554aSColin Percival -- Dru <genesis@istar.ca> 656ae1554aSColin Percival% 666ae1554aSColin PercivalIf you need to ask a question on the FreeBSD-questions mailing list then 676ae1554aSColin Percival 687e3f9a34SEitan Adler https://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/\ 696ae1554aSColin Percival freebsd-questions/index.html 706ae1554aSColin Percival 716ae1554aSColin Percivalcontains lots of useful advice to help you get the best results. 726ae1554aSColin Percival% 736ae1554aSColin PercivalIf you write part of a filename in tcsh, 746ae1554aSColin Percivalpressing TAB will show you the available choices when there 756ae1554aSColin Percivalis more than one, or complete the filename if there's only one match. 766ae1554aSColin Percival% 776ae1554aSColin PercivalIf you `set watch = (0 any any)' in tcsh, you will be notified when 786ae1554aSColin Percivalsomeone logs in or out of your system. 796ae1554aSColin Percival% 806ae1554aSColin PercivalIf you use the C shell, add the following line to the .cshrc file in your 816ae1554aSColin Percivalhome directory to prevent core files from being written to disk: 826ae1554aSColin Percival 836ae1554aSColin Percival limit coredumpsize 0 846ae1554aSColin Percival -- Dru <genesis@istar.ca> 856ae1554aSColin Percival% 866ae1554aSColin PercivalIf you want df(1) and other commands to display disk sizes in 876ae1554aSColin Percivalkilobytes instead of 512-byte blocks, set BLOCKSIZE in your 886ae1554aSColin Percivalenvironment to 'K'. You can also use 'M' for Megabytes or 'G' for 896ae1554aSColin PercivalGigabytes. If you want df(1) to automatically select the best size 906ae1554aSColin Percivalthen use 'df -h'. 916ae1554aSColin Percival% 926ae1554aSColin PercivalIf you want to play CDs with FreeBSD, a utility for this is already included. 936ae1554aSColin PercivalType 'cdcontrol' then 'help' to learn more. (You may need to set the CDROM 946ae1554aSColin Percivalenvironment variable in order to make cdcontrol want to start.) 956ae1554aSColin Percival% 966ae1554aSColin PercivalIf you'd like to keep track of applications in the FreeBSD ports tree, take a 976ae1554aSColin Percivallook at FreshPorts; 986ae1554aSColin Percival 997e3f9a34SEitan Adler https://www.freshports.org/ 1006ae1554aSColin Percival% 1016ae1554aSColin PercivalIn order to make fetch (the FreeBSD downloading tool) ask for 1026ae1554aSColin Percivalusername/password when it encounters a password-protected web page, you can set 1036ae1554aSColin Percivalthe environment variable HTTP_AUTH to 'basic:*'. 1046ae1554aSColin Percival% 1056ae1554aSColin PercivalIn order to search for a string in some files, use 'grep' like this: 1066ae1554aSColin Percival 1076ae1554aSColin Percival grep "string" filename1 [filename2 filename3 ...] 1086ae1554aSColin Percival 1096ae1554aSColin PercivalThis will print out the lines in the files that contain the string. grep can 1106ae1554aSColin Percivalalso do a lot more advanced searches - type 'man grep' for details. 1116ae1554aSColin Percival% 1126ae1554aSColin PercivalIn order to support national characters for European languages in tools like 1136ae1554aSColin Percivalless without creating other nationalisation aspects, set the environment 114*ff744dbdSEitan Adlervariable LC_ALL to 'en_US.UTF-8'. 1156ae1554aSColin Percival% 1161909a1f4SAlfred Perlstein"man firewall" will give advice for building a FreeBSD firewall using ipfw(8). 1176ae1554aSColin Percival -- David Scheidt <dscheidt@tumbolia.com> 1186ae1554aSColin Percival% 1196ae1554aSColin Percival"man hier" will explain the way FreeBSD filesystems are normally laid out. 1206ae1554aSColin Percival -- David Scheidt <dscheidt@tumbolia.com> 1216ae1554aSColin Percival% 1226ae1554aSColin PercivalMan pages are divided into section depending on topic. There are 9 different 1236ae1554aSColin Percivalsections numbered from 1 (General Commands) to 9 (Kernel Developer's Manual). 1246ae1554aSColin PercivalYou can get an introduction to each topic by typing 1256ae1554aSColin Percival 1266ae1554aSColin Percival man <number> intro 1276ae1554aSColin Percival 1286ae1554aSColin PercivalIn other words, to get the intro to general commands, type 1296ae1554aSColin Percival 1306ae1554aSColin Percival man 1 intro 1316ae1554aSColin Percival% 1326ae1554aSColin Percival"man ports" gives many useful hints about installing FreeBSD ports. 1336ae1554aSColin Percival% 1346ae1554aSColin Percival"man security" gives very good advice on how to tune the security of your 1356ae1554aSColin PercivalFreeBSD system. 1366ae1554aSColin Percival% 1376ae1554aSColin Percival"man tuning" gives some tips how to tune performance of your FreeBSD system. 1386ae1554aSColin Percival -- David Scheidt <dscheidt@tumbolia.com> 1396ae1554aSColin Percival% 1406ae1554aSColin PercivalNeed to do a search in a manpage or in a file you've sent to a pager? Use 1411909a1f4SAlfred Perlstein"/search_word". To repeat the same search, type "n" for next or "p" for 1421909a1f4SAlfred Perlsteinprevious. 1436ae1554aSColin Percival -- Dru <genesis@istar.ca> 1446ae1554aSColin Percival% 1456ae1554aSColin PercivalNeed to find the location of a program? Use "locate program_name". 1466ae1554aSColin Percival -- Dru <genesis@istar.ca> 1476ae1554aSColin Percival% 1486ae1554aSColin PercivalNeed to leave your terminal for a few minutes and don't want to logout? 1496ae1554aSColin PercivalUse "lock -p". When you return, use your password as the key to unlock the 1506ae1554aSColin Percivalterminal. 1516ae1554aSColin Percival -- Dru <genesis@istar.ca> 1526ae1554aSColin Percival% 1536ae1554aSColin PercivalNeed to quickly empty a file? Use ": > filename". 1546ae1554aSColin Percival -- Dru <genesis@istar.ca> 1556ae1554aSColin Percival% 1566ae1554aSColin PercivalNeed to quickly return to your home directory? Type "cd". 1576ae1554aSColin Percival -- Dru <genesis@istar.ca> 1586ae1554aSColin Percival% 1596ae1554aSColin PercivalNeed to remove all those ^M characters from a DOS file? Try 1606ae1554aSColin Percival 1616ae1554aSColin Percival tr -d \\r < dosfile > newfile 1626ae1554aSColin Percival -- Originally by Dru <genesis@istar.ca> 1636ae1554aSColin Percival% 1646ae1554aSColin PercivalNeed to see the calendar for this month? Simply type "cal". To see the 1656ae1554aSColin Percivalwhole year, type "cal -y". 1666ae1554aSColin Percival -- Dru <genesis@istar.ca> 1676ae1554aSColin Percival% 1686ae1554aSColin PercivalNeed to see which daemons are listening for connection requests? Use 1696ae1554aSColin Percival"sockstat -4l" for IPv4, and "sockstat -l" for IPv4 and IPv6. 1706ae1554aSColin Percival -- Dru <genesis@istar.ca> 1716ae1554aSColin Percival% 1726ae1554aSColin PercivalNeed to see your routing table? Type "netstat -rn". The entry with the G 1736ae1554aSColin Percivalflag is your gateway. 1746ae1554aSColin Percival -- Dru <genesis@istar.ca> 1756ae1554aSColin Percival% 1766ae1554aSColin PercivalNice bash prompt: PS1='(\[$(tput md)\]\t <\w>\[$(tput me)\]) $(echo $?) \$ ' 1776ae1554aSColin Percival -- Mathieu <mathieu@hal.interactionvirtuelle.com> 1786ae1554aSColin Percival% 1791909a1f4SAlfred PerlsteinOver quota? "du -sh * | sort -h " will give you a sorted list of your 1806ae1554aSColin Percivaldirectory sizes. 1816ae1554aSColin Percival -- David Scheidt <dscheidt@tumbolia.com> 1826ae1554aSColin Percival% 1836ae1554aSColin Percivalnc(1) (or netcat) is useful not only for redirecting input/output to 1846ae1554aSColin PercivalTCP or UDP connections, but also for proxying them with inetd(8). 1856ae1554aSColin Percival% 1866ae1554aSColin Percivalsh (the default Bourne shell in FreeBSD) supports command-line editing. Just 1871909a1f4SAlfred Perlstein``set -o emacs'' or ``set -o vi'' to enable it. Use "<TAB>" key to complete 1881909a1f4SAlfred Perlsteinpaths. 1896ae1554aSColin Percival% 1906ae1554aSColin PercivalSimple tcsh prompt: set prompt = '%# ' 1916ae1554aSColin Percival% 1926ae1554aSColin PercivalThe default editor in FreeBSD is vi, which is efficient to use when you have 1936ae1554aSColin Percivallearned it, but somewhat user-unfriendly. To use ee (an easier but less 1946ae1554aSColin Percivalpowerful editor) instead, set the environment variable EDITOR to /usr/bin/ee 1956ae1554aSColin Percival% 1966ae1554aSColin PercivalTime to change your password? Type "passwd" and follow the prompts. 1976ae1554aSColin Percival -- Dru <genesis@istar.ca> 1986ae1554aSColin Percival% 1996ae1554aSColin PercivalTo change an environment variable in /bin/sh use: 2006ae1554aSColin Percival 2016ae1554aSColin Percival $ VARIABLE="value" 2026ae1554aSColin Percival $ export VARIABLE 2036ae1554aSColin Percival% 2046ae1554aSColin PercivalTo change an environment variable in tcsh you use: setenv NAME "value" 2056ae1554aSColin Percivalwhere NAME is the name of the variable and "value" its new value. 2066ae1554aSColin Percival% 2076ae1554aSColin PercivalTo clear the screen, use "clear". To re-display your screen buffer, press 2086ae1554aSColin Percivalthe scroll lock key and use your page up button. When you're finished, 2096ae1554aSColin Percivalpress the scroll lock key again to get your prompt back. 2106ae1554aSColin Percival -- Dru <genesis@istar.ca> 2116ae1554aSColin Percival% 2121909a1f4SAlfred PerlsteinYou can press Ctrl-L while in the shell to clear the screen. 2131909a1f4SAlfred Perlstein% 2146ae1554aSColin PercivalTo determine whether a file is a text file, executable, or some other type 2156ae1554aSColin Percivalof file, use 2166ae1554aSColin Percival 2176ae1554aSColin Percival file filename 2186ae1554aSColin Percival -- Dru <genesis@istar.ca> 2196ae1554aSColin Percival% 2206ae1554aSColin PercivalTo do a fast search for a file, try 2216ae1554aSColin Percival 2226ae1554aSColin Percival locate filename 2236ae1554aSColin Percival 2246ae1554aSColin Percivallocate uses a database that is updated every Saturday (assuming your computer 2256ae1554aSColin Percivalis running FreeBSD at the time) to quickly find files based on name only. 2266ae1554aSColin Percival% 2276ae1554aSColin PercivalTo erase a line you've written at the command prompt, use "Ctrl-U". 2286ae1554aSColin Percival -- Dru <genesis@istar.ca> 2296ae1554aSColin Percival% 2301909a1f4SAlfred PerlsteinTo find out the hostname associated with an IP address, use 2316ae1554aSColin Percival 2326ae1554aSColin Percival drill -x IP_address 2331909a1f4SAlfred Perlstein -- Dru <genesis@istar.ca> 2346ae1554aSColin Percival% 2356ae1554aSColin PercivalTo obtain a neat PostScript rendering of a manual page, use ``-t'' switch 2366ae1554aSColin Percivalof the man(1) utility: ``man -t <topic>''. For example: 2376ae1554aSColin Percival 2386ae1554aSColin Percival man -t grep > grep.ps # Save the PostScript version to a file 2396ae1554aSColin Percivalor 2406ae1554aSColin Percival man -t printf | lp # Send the PostScript directly to printer 2416ae1554aSColin Percival% 2426ae1554aSColin PercivalTo quickly create an empty file, use "touch filename". 2436ae1554aSColin Percival -- Dru <genesis@istar.ca> 2446ae1554aSColin Percival% 2456ae1554aSColin PercivalTo read a compressed file without having to first uncompress it, use 2461909a1f4SAlfred Perlstein"zcat" or "zless" to view it. There is also "bzcat", "bzless", "xzcat" 2471909a1f4SAlfred Perlsteinand "xzless". 2486ae1554aSColin Percival -- Dru <genesis@istar.ca> 2496ae1554aSColin Percival% 2506ae1554aSColin PercivalTo save disk space in your home directory, compress files you rarely 2516ae1554aSColin Percivaluse with "gzip filename". 2526ae1554aSColin Percival -- Dru <genesis@istar.ca> 2536ae1554aSColin Percival% 2546ae1554aSColin PercivalTo search for files that match a particular name, use find(1); for example 2556ae1554aSColin Percival 2566ae1554aSColin Percival find / -name "*GENERIC*" -ls 2576ae1554aSColin Percival 2586ae1554aSColin Percivalwill search '/', and all subdirectories, for files with 'GENERIC' in the name. 2596ae1554aSColin Percival -- Stephen Hilton <nospam@hiltonbsd.com> 2606ae1554aSColin Percival% 2616ae1554aSColin PercivalTo see all of the directories on your FreeBSD system, type 2626ae1554aSColin Percival 2636ae1554aSColin Percival find / -type d | less 2646ae1554aSColin Percival 2656ae1554aSColin PercivalAll the files? 2666ae1554aSColin Percival 2676ae1554aSColin Percival find / -type f | less 2686ae1554aSColin Percival% 2696ae1554aSColin PercivalTo see how long it takes a command to run, type the word "time" before the 2706ae1554aSColin Percivalcommand name. 2716ae1554aSColin Percival -- Dru <genesis@istar.ca> 2726ae1554aSColin Percival% 2736ae1554aSColin PercivalTo see how much disk space is left on your partitions, use 2746ae1554aSColin Percival 2756ae1554aSColin Percival df -h 2766ae1554aSColin Percival -- Dru <genesis@istar.ca> 2776ae1554aSColin Percival% 2786ae1554aSColin PercivalTo see the 10 largest files on a directory or partition, use 2796ae1554aSColin Percival 2801909a1f4SAlfred Perlstein du -h /partition_or_directory_name | sort -rh | head 2816ae1554aSColin Percival -- Dru <genesis@istar.ca> 2826ae1554aSColin Percival% 2836ae1554aSColin PercivalTo see the IP addresses currently set on your active interfaces, type 2846ae1554aSColin Percival"ifconfig -u". 2856ae1554aSColin Percival -- Dru <genesis@istar.ca> 2866ae1554aSColin Percival% 2876ae1554aSColin PercivalTo see the last 10 lines of a long file, use "tail filename". To see the 2881909a1f4SAlfred Perlsteinfirst 10 lines, use "head filename". To see new lines as they're appended 2891909a1f4SAlfred Perlsteinto a file, use "tail -f filename". 2906ae1554aSColin Percival -- Dru <genesis@istar.ca> 2916ae1554aSColin Percival% 2926ae1554aSColin PercivalTo see the last time that you logged in, use lastlogin(8). 2936ae1554aSColin Percival -- Dru <genesis@istar.ca> 2946ae1554aSColin Percival% 2956ae1554aSColin PercivalTo see the MAC addresses of the NICs on your system, type 2966ae1554aSColin Percival 2976ae1554aSColin Percival ifconfig -a 2986ae1554aSColin Percival -- Dru <genesis@istar.ca> 2996ae1554aSColin Percival% 3006ae1554aSColin PercivalTo see the output from when your computer started, run dmesg(8). If it has 3016ae1554aSColin Percivalbeen replaced with other messages, look at /var/run/dmesg.boot. 3026ae1554aSColin Percival -- Francisco Reyes <lists@natserv.com> 3036ae1554aSColin Percival% 3046ae1554aSColin PercivalWant colour in your directory listings? Use "ls -G". "ls -F" is also useful, 3056ae1554aSColin Percivaland they can be combined as "ls -FG". 3066ae1554aSColin Percival% 3076ae1554aSColin PercivalWant to find a specific port, just type the following under /usr/ports 3086ae1554aSColin Percivalor one its subdirectories: 3096ae1554aSColin Percival 3106ae1554aSColin Percival make search name=<port-name> 3116ae1554aSColin Percival or 3126ae1554aSColin Percival make search key=<keyword> 3136ae1554aSColin Percival% 3146ae1554aSColin PercivalWant to know how many words, lines, or bytes are contained in a file? Type 3156ae1554aSColin Percival"wc filename". 3166ae1554aSColin Percival -- Dru <genesis@istar.ca> 3176ae1554aSColin Percival% 3186ae1554aSColin PercivalWant to see how much virtual memory you're using? Just type "swapinfo" to 3196ae1554aSColin Percivalbe shown information about the usage of your swap partitions. 3206ae1554aSColin Percival% 3216ae1554aSColin PercivalWant to strip UTF-8 BOM(Byte Order Mark) from given files? 3226ae1554aSColin Percival 3236ae1554aSColin Percival sed -e '1s/^\xef\xbb\xbf//' < bomfile > newfile 3246ae1554aSColin Percival% 3256ae1554aSColin PercivalWant to use sed(1) to edit a file in place? Well, to replace every 'e' with 3266ae1554aSColin Percivalan 'o', in a file named 'foo', you can do: 3276ae1554aSColin Percival 3286ae1554aSColin Percival sed -i.bak s/e/o/g foo 3296ae1554aSColin Percival 3306ae1554aSColin PercivalAnd you'll get a backup of the original in a file named 'foo.bak', but if you 3316ae1554aSColin Percivalwant no backup: 3326ae1554aSColin Percival 3336ae1554aSColin Percival sed -i '' s/e/o/g foo 3346ae1554aSColin Percival% 3356ae1554aSColin PercivalWhen you've made modifications to a file in vi(1) and then find that 3366ae1554aSColin Percivalyou can't write it, type ``<ESC>!rm -f %'' then ``:w!'' to force the 3376ae1554aSColin Percivalwrite 3386ae1554aSColin Percival 3396ae1554aSColin PercivalThis won't work if you don't have write permissions to the directory 3406ae1554aSColin Percivaland probably won't be suitable if you're editing through a symbolic link. 3411909a1f4SAlfred Perlstein 3421909a1f4SAlfred PerlsteinIf you have sudo(8) installed and permissions to use it, type 3431909a1f4SAlfred Perlstein``<ESC>w ! sudo tee %'' to force a write. 3446ae1554aSColin Percival% 3456ae1554aSColin PercivalYou can adjust the volume of various parts of the sound system in your 3466ae1554aSColin Percivalcomputer by typing 'mixer <type> <volume>'. To get a list of what you can 3476ae1554aSColin Percivaladjust, just type 'mixer'. 3486ae1554aSColin Percival% 3496ae1554aSColin PercivalYou can automatically download and install binary packages by doing 3506ae1554aSColin Percival 3516ae1554aSColin Percival pkg install <package> 3526ae1554aSColin Percival 3536ae1554aSColin PercivalThis will also automatically install the packages that are dependencies 3546ae1554aSColin Percivalfor the package you install (ie, the packages it needs in order to work.) 3556ae1554aSColin Percival% 3566ae1554aSColin PercivalYou can change the video mode on all consoles by adding something like 3576ae1554aSColin Percivalthe following to /etc/rc.conf: 3586ae1554aSColin Percival 3596ae1554aSColin Percival allscreens="80x30" 3606ae1554aSColin Percival 3616ae1554aSColin PercivalYou can use "vidcontrol -i mode | grep T" for a list of supported text 3626ae1554aSColin Percivalmodes. 3636ae1554aSColin Percival -- Konstantinos Konstantinidis <kkonstan@duth.gr> 3646ae1554aSColin Percival% 3656ae1554aSColin PercivalYou can disable tcsh's terminal beep if you `set nobeep'. 3666ae1554aSColin Percival% 3676ae1554aSColin PercivalYou can install extra packages for FreeBSD by using the ports system. 3686ae1554aSColin PercivalIf you have installed it, you can download, compile, and install software by 3696ae1554aSColin Percivaljust typing 3706ae1554aSColin Percival 3716ae1554aSColin Percival # cd /usr/ports/<category>/<portname> 3726ae1554aSColin Percival # make install && make clean 3736ae1554aSColin Percival 3746ae1554aSColin Percivalas root. The ports infrastructure will download the software, change it so 3756ae1554aSColin Percivalit works on FreeBSD, compile it, install it, register the installation so it 3766ae1554aSColin Percivalwill be possible to automatically uninstall it, and clean out the temporary 3776ae1554aSColin Percivalworking space it used. You can remove an installed port you decide you do not 3786ae1554aSColin Percivalwant after all by typing 3796ae1554aSColin Percival 3806ae1554aSColin Percival # cd /usr/ports/<category>/<portname> 3816ae1554aSColin Percival # make deinstall 3826ae1554aSColin Percival 3836ae1554aSColin Percivalas root. 3846ae1554aSColin Percival% 3856ae1554aSColin PercivalYou can look through a file in a nice text-based interface by typing 3866ae1554aSColin Percival 3876ae1554aSColin Percival less filename 3886ae1554aSColin Percival% 3896ae1554aSColin PercivalYou can make a log of your terminal session with script(1). 3906ae1554aSColin Percival% 3916ae1554aSColin PercivalYou can often get answers to your questions about FreeBSD by searching in the 3926ae1554aSColin PercivalFreeBSD mailing list archives at 3936ae1554aSColin Percival 3941909a1f4SAlfred Perlstein http://freebsd.markmail.org 3956ae1554aSColin Percival% 3966ae1554aSColin PercivalYou can open up a new split-screen window in (n)vi with :N or :E and then 3976ae1554aSColin Percivaluse ^w to switch between the two. 3986ae1554aSColin Percival% 3996ae1554aSColin PercivalYou can permanently set environment variables for your shell by putting them 4006ae1554aSColin Percivalin a startup file for the shell. The name of the startup file varies 4016ae1554aSColin Percivaldepending on the shell - csh and tcsh uses .login, bash, sh, ksh and zsh use 4026ae1554aSColin Percival.profile. When using bash, sh, ksh or zsh, don't forget to export the 4036ae1554aSColin Percivalvariable. 4046ae1554aSColin Percival% 4056ae1554aSColin PercivalYou can press Ctrl-D to quickly exit from a shell, or logout from a 4066ae1554aSColin Percivallogin shell. 4076ae1554aSColin Percival -- Konstantinos Konstantinidis <kkonstan@duth.gr> 4086ae1554aSColin Percival% 4096ae1554aSColin PercivalYou can press up-arrow or down-arrow to walk through a list of 4106ae1554aSColin Percivalprevious commands in tcsh. 4116ae1554aSColin Percival% 4126ae1554aSColin PercivalYou can search for documentation on a keyword by typing 4136ae1554aSColin Percival 4146ae1554aSColin Percival apropos keyword 4156ae1554aSColin Percival% 4166ae1554aSColin PercivalYou can `set autologout = 30' to have tcsh log you off automatically 4176ae1554aSColin Percivalif you leave the shell idle for more than 30 minutes. 4186ae1554aSColin Percival% 4196ae1554aSColin PercivalYou can use aliases to decrease the amount of typing you need to do to get 4206ae1554aSColin Percivalcommands you commonly use. Examples of fairly popular aliases include (in 4216ae1554aSColin PercivalBourne shell style, as in /bin/sh, bash, ksh, and zsh): 4226ae1554aSColin Percival 4236ae1554aSColin Percival alias lf="ls -FA" 4246ae1554aSColin Percival alias ll="ls -lA" 4256ae1554aSColin Percival alias su="su -m" 4266ae1554aSColin Percival 4276ae1554aSColin PercivalIn csh or tcsh, these would be 4286ae1554aSColin Percival 4296ae1554aSColin Percival alias lf ls -FA 4306ae1554aSColin Percival alias ll ls -lA 4316ae1554aSColin Percival alias su su -m 4326ae1554aSColin Percival 4336ae1554aSColin PercivalTo remove an alias, you can usually use 'unalias aliasname'. To list all 4346ae1554aSColin Percivalaliases, you can usually type just 'alias'. 4356ae1554aSColin Percival% 4366ae1554aSColin PercivalYou can use /etc/make.conf to control the options used to compile software 4376ae1554aSColin Percivalon this system. Example entries are in 4381909a1f4SAlfred Perlstein/usr/share/examples/etc/make.conf and in make.conf(5). 4391909a1f4SAlfred PerlsteinFor options that are set for building FreeBSD's kernel and its world, see 4401909a1f4SAlfred Perlsteinsrc.conf(5). 4416ae1554aSColin Percival% 4426ae1554aSColin PercivalYou can use "pkg info" to see a list of packages you have installed. 4436ae1554aSColin Percival% 4446ae1554aSColin PercivalYou can use the 'fetch' command to retrieve files over ftp, http or https. 4456ae1554aSColin Percival 4467e3f9a34SEitan Adler fetch https://www.FreeBSD.org/index.html 4476ae1554aSColin Percival 4486ae1554aSColin Percivalwill download the front page of the FreeBSD web site. 4496ae1554aSColin Percival% 4506ae1554aSColin PercivalYou can use "whereis" to search standard binary, manual page and source 4516ae1554aSColin Percivaldirectories for the specified programs. This can be particularly handy 4526ae1554aSColin Percivalwhen you are trying to find where in the ports tree an application is. 4536ae1554aSColin Percival 4546ae1554aSColin PercivalTry "whereis firefox" and "whereis whereis". 4556ae1554aSColin Percival -- Konstantinos Konstantinidis <kkonstan@duth.gr> 4566ae1554aSColin Percival% 4576ae1554aSColin PercivalWant to run the same command again? 458*ff744dbdSEitan AdlerType "!!". 4596ae1554aSColin Percival% 4606ae1554aSColin PercivalWant to go the directory you were just in? 4616ae1554aSColin PercivalType "cd -" 4626ae1554aSColin Percival% 4631909a1f4SAlfred PerlsteinCan't delete /usr/obj? Enter "chflags -R noschg /usr/obj" to remove the 4641909a1f4SAlfred Perlsteinsystem immutable flag for all files in /usr/obj. 4651909a1f4SAlfred Perlstein 4661909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 4671909a1f4SAlfred Perlstein% 4681909a1f4SAlfred PerlsteinWant to list all files of an installed package? Enter 4691909a1f4SAlfred Perlstein"pkg info -l packagename". 4701909a1f4SAlfred Perlstein 4711909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 4721909a1f4SAlfred Perlstein% 4731909a1f4SAlfred PerlsteinAre you looking for a package? Search for it with 4741909a1f4SAlfred Perlstein"pkg search part_of_package_name" 4751909a1f4SAlfred Perlstein 4761909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 4771909a1f4SAlfred Perlstein% 4781909a1f4SAlfred PerlsteinIf you want to recursively copy a directory preserving file and directory 4791909a1f4SAlfred Perlsteinattributes use 4801909a1f4SAlfred Perlstein"cp -a source target" 4811909a1f4SAlfred Perlstein 4821909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 4831909a1f4SAlfred Perlstein% 4841909a1f4SAlfred PerlsteinDo you wonder what a terminal program is doing at the moment? dd(1) does not 48573132e7bSAlfred Perlsteinshow any throughput? Hit "^T" (Control + t) to send SIGINFO to the process 4861909a1f4SAlfred Perlsteinand see what it is doing. 4871909a1f4SAlfred Perlstein 4881909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 4891909a1f4SAlfred Perlstein% 4901909a1f4SAlfred PerlsteinDo you want to know which version of FreeBSD you are running? Enter 4911909a1f4SAlfred Perlstein"freebsd-version -ku" to display kernel and userland version. 4921909a1f4SAlfred Perlstein 4931909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 4941909a1f4SAlfred Perlstein% 4951909a1f4SAlfred PerlsteinIf you want to end one or more processes at a time using a regular expression 4961909a1f4SAlfred Perlsteinenter "pkill regex". 4971909a1f4SAlfred Perlstein 4981909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 4991909a1f4SAlfred Perlstein% 5001909a1f4SAlfred PerlsteinDo you want to run a program directly after some other process has ended? Use 5011909a1f4SAlfred Perlstein"pwait pid && new_program" 5021909a1f4SAlfred Perlstein 5031909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 5041909a1f4SAlfred Perlstein% 5051909a1f4SAlfred PerlsteinWhen you want your users to be able to reboot or shutdown FreeBSD, add them 5061909a1f4SAlfred Perlsteinto the group "operator" and they are allowed to use shutdown(8) and poweroff(8). 5071909a1f4SAlfred Perlstein 5081909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 5091909a1f4SAlfred Perlstein% 5101909a1f4SAlfred PerlsteinIf you need to create a FAT32 formatted USB thumb drive, find out its devicename 5111909a1f4SAlfred Perlsteinrunning dmesg(8) after inserting it. Then create an MBR schema, a single slice and 5121909a1f4SAlfred Perlsteinformat it: 5131909a1f4SAlfred Perlstein 5141909a1f4SAlfred Perlstein# gpart create -s MBR ${devicename} 5151909a1f4SAlfred Perlstein# gpart add -t fat32 ${devicename} 5161909a1f4SAlfred Perlstein# newfs_msdos -F 32 -L thumbdrive ${devicename}s1 5171909a1f4SAlfred Perlstein 5181909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 5191909a1f4SAlfred Perlstein% 5201909a1f4SAlfred PerlsteinIf you want to get a sorted list of all services that are started when FreeBSD boots, 5211909a1f4SAlfred Perlsteinenter "service -e". 5221909a1f4SAlfred Perlstein 5231909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 5241909a1f4SAlfred Perlstein% 5251909a1f4SAlfred PerlsteinTo easily configure your installed FreeBSD use bsdconfig(8). 5261909a1f4SAlfred Perlstein 5271909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 5281909a1f4SAlfred Perlstein% 5291909a1f4SAlfred PerlsteinAfter you compiled and installed a new version of FreeBSD, use etcupdate(8) to merge 5301909a1f4SAlfred Perlsteinconfiguration updates. 5311909a1f4SAlfred PerlsteinRun "etcupdate extract" once when your sources match your running system, then run 5321909a1f4SAlfred Perlstein"etcupdate" after every upgrade and "etcupdate resolve" to resolve any conflicts. 5331909a1f4SAlfred Perlstein 5341909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 5351909a1f4SAlfred Perlstein% 5361909a1f4SAlfred PerlsteinDo you want to do a binary upgrade of your running FreeBSD installation? Use freebsd-update(8). 5371909a1f4SAlfred Perlstein 5381909a1f4SAlfred PerlsteinTo install updates and patches for the running branch use 5391909a1f4SAlfred Perlstein# freebsd-update fetch install 5401909a1f4SAlfred Perlstein 5411909a1f4SAlfred PerlsteinTo upgrade to a newer release use 5421909a1f4SAlfred Perlstein# freebsd-update upgrade -r ${name_of_release} 5431909a1f4SAlfred Perlstein 5441909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 5451909a1f4SAlfred Perlstein% 5461909a1f4SAlfred PerlsteinTo run rc scripts in /etc/rc.d and /usr/local/etc/rc.d use service(8). 5471909a1f4SAlfred PerlsteinRun "service ${name_of_rc_script} start" to start a daemon and 5481909a1f4SAlfred Perlstein"service ${name_of_rc_script} stop" to stop it. 5491909a1f4SAlfred Perlstein 5501909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 5511909a1f4SAlfred Perlstein% 5521909a1f4SAlfred PerlsteinIf you don't want to edit /etc/rc.conf directly, use sysrc(8) to add and remove entries. 5531909a1f4SAlfred PerlsteinUse "sysrc name=value" to add an entry and "sysrc -x name" to delete an entry. 5541909a1f4SAlfred Perlstein 5551909a1f4SAlfred Perlstein -- Lars Engels <lme@FreeBSD.org> 5561909a1f4SAlfred Perlstein% 557