Transfer from: freebsdchina.orghttp: //people.freebsdchina.org/mill...reebsdtips.html1 Is it a CD to each directory? In fact, there is a better way .. That is to look at the man man: #man hier 2, during the console, due to the limited screen display, sometimes you need to see the previously displayed information, then you can:. Press PAUSE After the or scroll lock key, you can use the PageUp PageDown Up Downhome End and other keys to see the data displayed before and after. Press the PAUSE OR SCROLL LOCK. You can reply to wait for the input screen .3, use the PW to manage your account Used under FreeBSD AddUser adds an account, which will be annoying, available in the following way: PW useradd -n -g -m -s / bin / csh => -m represents the establishment of the user directory ● GEE Echo | PW useradd -n -g -m -s / bin / csh -h 0 ● Delete account PW userDel -n -r => -r represents the same manner to delete its Home directory and other related materials ● Modify account PW usermod -g -s / bin / cshps: Unable Modify account name ● Lock and unlock users PW Lock PW Unlock 4, activation Your ScreenSaver Since freensd is mostly used for host, it is not shutdown, so you can turn off the screen, or use the Screensaver feature .. Screensaver Please add the following two lines in /etc/rc.conf: blankTime = "900" => in seconds number, as 15 minutes saver = "logo" => logo is freebsd mascot (diagram Interface), can also use "daemon", which is text type 5, check your ports version and update If you want to update all ports only need to perform the following instructions in / etc / ports / down: # Make Update Sometimes we You may have to check the version of a ports. Every line in each ports has this line portversion = XXX can see this Ports version, and can also use the following way (GREP), such as we want to watch mod_php4 Version # grep portversion = / usr / ports / www / mod_php4 / makefileportversion = 1.4.1 -> version message If the version is too old, you can use the following method to update single portsa . Use the portupgrade or portinstall, use the man to view the method b. Go to the FreeBSD website to query the latest ports information, and catch the ports back to update the URL: http://www.freebsd.org/cgi/cvsweb.cgi/ports/ Catch back In the relevant directory update, for example, we caught the mod_php4.tar.gz, in the presence / usr / tmp / directory, the way to decompress is as follows:
# CD / usr / ports / www / mod_php4 # tar xzvf /usr/tmp/mod_php4.tar.gz This is OK ..6, speed your button speed .. I believe many of people using FreeBSD is in Console Let's repeat a button speed .. Another problem is that the location of CUSROR is not too obvious .. Use the following method to improve: Add the following information in /etc/rc.conf ..KeyRate = "Fast" CURSOR = "blink" or "deStructive" 7, the power-on screen uses Windows, knows the so-called boot screen, do you have this function in FreeBSD? The answer is affirmative, and the setting is easier, please take the following steps: 1. First, make a diagram file, the file format is logo.pcx or logo.bmp, you need to pay attention to the .bmp file storage does not need to be compressed, The resolution is within 640 x 480 (inclusive), the color order is 256 colors .. II. Way this file COPY to / boot / this directory. Set /Boot/Loader.conf, add the following information Splash_BMP_LOAD = "YES "-> If you use .bmp format, this item needs to be set to YessPlash_PCX_LOAD =" YES "-> Use .pcx, set this to Yesvera_Load =" YES "Bitmap_Load =" YES "Bitmap_name =" / boot / logo.pcx "-> Please change bitmap_type =" splash_image_data "according to your file format. Reactivate PS: Please check if you have the following information in your kernel, usually in 4.x is the internal value .., as for 3. X version, it has not been used .. ^. ^ preudo-device splash If not, you need to add this line to the core. 8, some quick keys used under some console .. I believe most users using Unix-Like And do your daily maintenance work under Console, there are those key combinations to help us improve efficiency .. The following buttons apply to TCSH and Bash..1. Fast mobile cursor ctrl a-> to the front Ctrl E -> to the last side 2. Edit Ctrl D -> Delete the cursor where the cursor is located in the character Ctrl U -> Bash: Ctrl U -> BASH: All words and characters before the cursor are deleted, TCSH: Delete all characters Ctrl K -> Delete all characters after the cursor b -> Next Character Ctrl F -> Previous Character Ctrl M -> and Press ENTER's result Ctrl H -> And press the DEL or Backspace key Del or backspace -> Delete the previous character If the button has a research interest, the reference / usr / share / syscons / keymaps / this directory, where usiso.kbd is usually usually used Buttons ..9, fast switching directory often need to switch directories in FreeBSD, sometimes the directory name is longer, or case sensitive, or only to remember the previous words, what to do .. In fact, just enter a part. On * This symbol is OK .. As we have to switch to / usr / local / this directory,
Just enter CD / USR / LO * is ok .. What will be entered if CD / USR / L *? Then go to the / usr / lib / this directory, because shell finds the first conformance condition to stop ..10, the time-related time time zone is used to use freebsd to be used for hosting, then time to time The correctness is very important. The following describes how to make a time time time zone ● Time correction 1. Use the Date instruction format Date [YYMMDD] hhmm Description: YY years, such as 02 representative 2002 mm month 01-12dd daily 01-31hh Time 01-59mm Minutes 01-59 2. Using the timing host # ntpdate clock.stdtime.gov.tw This need to connect to the network, where clock.stdime.gov.tw is a standard time host ● Time zone Dedicated 1. Use tzsetup2. There is a file localtime in / etc /, this is the time zone setting file of this unit, so we can use it (not via Tzsetup), as follows: # cp / usr / share / zoneInfo / Asia / TAIPEI / ETC / LOCALTIME is not relatively fast ..11, how to empty the file content .. Sometimes we need to empty a file content, but you need to retain this file .. General usage is to use text editor, such as VI screamed this file, then deleted its contents, reopen the disk .. Is this still annoying? There is a better way to use the True Directive .. If we want to clear /var/log/httpd-access.log, then the following instructions .. # cd / var / log / # true> httpd-access.log12, Display Directory and Archives => Tree Sometimes you need to display all directories and files in a directory, although the use of LS can reach some function, but not very convenient .. In DOS, there is a Tree directive, is it full .. actually similar instructions in FreeBSD => Tree .. The following will install Tree # CD / USR / Ports / Sysutils through Ports; make install will install Tree instructions in / usr / local / bin / Use example: 1. Display / usr / down directory and file # tree / usr2. Only display / usr Directory # tree -d / usr Detailed Us, please refer to Man Treeps: Transmit to pipeline | And more to show like Tree / USR | more..13, how to view file type Since FreeBSD does not have concepts like DOS or Windows extension, how do you check a profile? Use File .. Syntax: File Details Please refer to Man File14, Repeat the previously used instructions You can use the following methods to reuse the previously used instructions: For example, let's display the previously entered instructions with HISTORY: # History ... 10 CLEAR11 CD / USR / LOCAL12 LS13 LS ETC14 CD ~ 15 CLS ETC14 CD ~ 15 CLS ETC14 CD ~ 15 CLEAR 1. Use UP Down to use the up and down one instruction, or Ctrl P Ctrl N is also 2. Match! Usage, for example (PS: in the <...> to enter the stuff)! # !! => Repeat the last instruction!
Site anastomosis #!? Etc? Execute 13 LS ETC or more instructions can be used under TCSH and Bash, and this is to help you save a lot of time ..15, how to print MAN's archives ..man is to learn FreeBSD's best information reference source, but see the bottom is not very convenient on the monitor, is there a way to transfer to a general file file? Use the colol.. Example We have to transfer SSH2 to ssh2.txt, then use the following syntax: #man ssh2 | col -b> ssh2.txt16, why not find the correct ports information .. in / usr / ports / There is a few thousand ports installation information, and sometimes we can check the relevant ports in the following ways .. The following is executed in / usr / ports / this directory ..1. First convert the ports into a text file. Sux.txt # make print-index> index.txt2. Using make search key = "...." to find 3. Convert the ports to readme.html by the above method, can easily find relevant Ports information, but very strange, why do I update a ports (or ports trees), why can't I find it, I still find the old information .. It turns out that there is one in / usr / ports / there is one Index file, the above query is in this index file. When you update the ports information, this index file will not be updated .. So for the convenience of query, we need to do it in manual way .. # After Make Index, then update index.txt and readme.html .. Update Index files take some time, approximately 12-30 minutes .. (depending on the computer level). 17, use DIG and Host to replace NSLookUp We use to check if there is a problem, mostly the following three instructions ..nslookuppingTraceRaoute where NSLLOKUP is used to check the DNS-related settings, and ping is used to check if you and the other network is smooth, and Traceroute is used to check Our computer has passed the line status of the other party's computer. However, in Nslookup, individual feel is not very practical, sometimes we just want to check a host or MX record, then use nslookup a little bit .. This introduces two good instructions Host and Dig. These two instructions are very similar, but the efficiency is more than NSLookup high # host -a
Whole / Boot/Loader.conf .. As long as you add the following lines in /boot/loader.conf, you can automoBoot_delay = "second", such as autoboot_delay = "7" represents 7 seconds, this is not faster. .. Also recommend, have time to refer to the setting of /boot/defaults/loader.conf, there are many practical settings, I forgot the root password If you forget the root password, this is FreeBSD is fully resolved, please handle the following steps to handle ..1. After entering the single mode, when Hit [Enter] to boot immediately, or any other key for command prospt.booting [kernel] IN 10 Seconds. .. Press Space (or bond other than ENTER) The key will enter the Command Prompt Mode, an OK .. Please enter boot -s to enter single-mode 2. Select SH to enter single mode, system will Ask you to use that SH, I use this, use this, press ENTER to skip 3. All hard disk split up # mount -a4. Change Password # Passwd length to be more than 6, input Second 5. Reactivate # reboot20, activation of kernel ..kernel is a very important ring for UNIX-Like systems, if kernel is damaged or compiled, may result in serious consequences ..freebsd Is there any protection measures in this regard with security? FreeBSD's kernel is placed in / directory, usually there will be two kernelkernel.Generic if you have a Kernel, the original kernel will turn into kernel.old, the new core will become kernel, that is The KERNEL file is as follows: kernel => Newly compiled core kernel.Generickernel.old => What is the original core Kernel.Generic? This is installed in the system installation, usually will not change, Even if the core is also compiled, this file can be said to be a life-saving core. It is best not to move, the reason is as follows. When this file is activated, if this file does not exist, it will catch kernel.old. Archive .. If this two files are unfortunate, what should I do. At this time, I will enter Command Prompt Mode. You must enter the name of the Kernel, such as boot, such as Boot Kernel.Generic, after the compilation core is not normal When executed, I believe that you know how to handle .. 21, freebsd in that activation program .. General FreeBSD will execute the program in the following position after activation .. 1. /etc/rc.conf This program, such as Sendmail Sshd .. All is executed here, but also pay attention to the setting of /etc/defaults/rc.conf before performing this file 2. /usr/local/etc/rc.d Some .sh files, the permissions of these files are set to x, such as apache samba .. all settings 3. /etc/rc.local is also set here, such as I want to set postfix this,
Just add a row in this file, as follows / use / local / sbin / postfix start & plus &, you will not display the message 4. Some files controlled by cron. When the time is here, it will be executed automatically .. The person who is fine may ask, /etc/inetd.conf is set? These are executed in the first item .. Learn about whether or not there is an unknown program, it is an important task of the daily viewing system .. 22, speed your host name query Speed .. UNIX-LIKE system, the initial use of Hosts set files to do the host's query, so some programs will refer to this setting file when checking the master name, like Sendmail is a good example .. System The first one is the file that will check / etc / hosts, so if there is a problem in it, it will affect the execution of some programs .. Typical Hosts file settings are as follows .. Take my own host 127.0 .0.1 localhost.cmlab.idv.tw localhost 61.219.230.5 cmlab.idv.tw cmlab 61.219.230.5 cmlab.idv.tw. The last item of the first and second lines is the AliaSES name (host alias), such as we are in the host Ping cmlab.idv.tw and ping cmlab are the same .. You can add some common hosts to this project, if there is a mail.cmlab.idv.tw, assume that IP is 61.219.230.8 in this hosts Join the following 61.219.230.8 mail.cmlab.idv.tw mail 61.219.230.8 mail.cmlab.idv.TW. This will be, if you have an self-operated DNS server, please note that in /etc/host.conf, typical The files are as follows: # $ freebsd: src / etc / host.conf, v 1.6 1999/08/27 23:23:41 Peter EXP $ # first Try the / etc / hosts file hosts # now Try the nameserver next. Bind # If you have yp / nis configured, uncomment the next line # NIS can be seen above, in the order of querying the host name, is the first check Hosts to check Bind is DNS, you can modify its order. Also pay attention to the /etc/resolv.conf file, this is the order of the DNS host Search, such as with my setting as follows: Domain cmlab.idv.tw name Server 61.219.230.5 Nameserver 168.95.1.1 Nameserver 168.95.192.1 Where the first line is to set my domain name, the second-4 line is the setting of the DNS host, it is recommended to set at least two, so as not to hang, There is also a spare .. Chain 2 is my DNS host, 3-4 lines are Hinet's DNS host .. Understand the above and correct settings, which helps the host's query and speed improvement .. 23, how do I divide the hard drive .. File Directory is quite important for FreeBSD (or all UNIX-Like systems), if the split is not very appropriate, it will encounter some trouble in the future, such as the space is not enough .. Waiting for the problem .. So, how do we split more appropriate .. This is about your use and freebsd directory architecture .. The general person is suggesting that you are so split: 1. / root directory,
Usually absolutely enough at 250 ~ 500 MB, in my root catalog, more than 66 MB is used for more than a year. Because this directory is just some of the "Swap file, the general people don't know how to set up the correct file, this is not a standard, the most important thing to see your RAM and hard drive, generally set up 1-2.5 times (relative to your RAM). If your RAM is more than 256 MB or more, it is doubled; if it is 64-128 MB, it is recommended to set up 2 times to check your SWAP usage, you can use the following instructions .. # pstat -t 44/4044 FILES 0M / 127M SWAP Space is seen from the above SWAP to 0, the set size is 128 m 3. / var Directory and / USR directory These two directory generally account for a relatively large space, / VAR changes smaller, in my personal, set to 8 GB a year ago, only 2GB is currently used. But pay attention to the general mail software, there is always / var / mail / in your letter, if your letters are or very large, this part may wish to increase some .. / usr this directory can give it a big Big space, because the programs installed, or Hone are in this directory (if you don't set the home directory into a split). What is the two to assign, my suggestion is USR and VAR The ratio is 3: 1, or 2: 1 4. Some host users, such as school units.
If you don't set home into a partition, FreeBSD will install home in the / usr directory, if you manage and security issues, you may wish to split Home into a single directory .. As for size, I want to 3-5 gb It's absolutely enough to use us to give an actual example, assume you have a 40-GB hard drive, using memory 128 MB RAM, then I suggest your hard disk so split .. 1. / => 250 MB 2. Swap = > Take 2 times, ie 256 MB 3. / Home To be independent, give it 3-5 GB 4. There is only 3: 1 or 2: 1 ratio of 3: 1 or 2: 1, it is only general recommendations. The most important thing is to understand the nature and actual use of the catalogs and appropriate use, information about this, you may wish to refer to Man Hier .. 25, simply edit your file file .. in UNIX-Like, standard The text editor is VI, but VI is not very easy to get started with beginners .. In FreeBSD is EE, this text editor, although there is no VI, but it is easy to use .. Novice may wish to in the early days Use an editor .. It is very simple to use, as long as you go under Command Line, you can # eE
Interested people can try themselves) 27. Some activation issues related to the system .. Sometimes some of FreeBSD's settings, such as some network parameters, software .conf settings, or /etc/r.conf files, So how do you make the set value take effect? Do you have to turn on? This can be divided into three aspects .. 1. Network-related settings, such as network adaptation cards, hostname .., etc., you can reload your network settings as long as you do the following instructions .. # sh / etc / netstart netStart It is a Script file that will be referred to /etc/rc.network when executed.
Therefore, you can reactivate the network settings as long as you execute this instruction .. Interesteders can refer to the two files of NetStart and RC.Network, and the study shows what is done. 2. Modified RC. Other settings in confes can be made to the following three steps .. Enter the single mode # Shutdown now. Select SH, create the value, ie / bin / sh. Leave single mode # EXT this will be re- Activate the system .. 3. Software settings, such as some * .conf files, like fixing Apache Sendmail .. Waiting in the /etc/local/rc.d/ This directory will be related .sh file, Direct execution is possible, pay attention to usually add parameters, the general parameters are below (depending on the software) .. START activation STOP Stop ReLoad or Restart Reactivate The second method is to use Killall, such as We have to reactivate inetd, you can use the following methods: # killall -1 inetd or # killall -hup inetd, you can reactivate this Daemon 28, protect your file in the system, there are many files or some setup files. Importantly, add the freebsd (or general unix-like) system without the functionality similar to the Garbage recovery barrel, if unfortunately deleted (or modify) an important file, it may cause a small trouble .. Although, FreeBSD is very strict for the permissions of the file, but in some cases, we will work with root, and you will still have this risk. How do you avoid this situation or protect certain important files? We can use Chflags to achieve this purpose, as the name suggests, chflags is composed of two words, namely Change and Flags (flags of files) .. For example, we have to protect /etc/inetd.conf file, so as not to delete or Modifications, the instructions are as follows: # chflags schg /etc/inetd.conf This file can be protected, if you want to display the flag (FLAG) of these files, you can use the LS to see .. # ls -lo /etc/inetd.conf => l is lower-written l -rw ------ 1 root wheel schg 47 mar 28 21:29 inetd.conf To unlock the flag setting, you can use unschg, which is before SCHG plus Un, such as: # CHFLAGS UNSCHG /ETC/INETD.CONF We enters the host to execute as root, so it is slightly unclear, it may be .. Therefore, it is recommended to set some important files and set files to SCHG Flags to protect files. .. such as / bin, / sbin, /etc/.conf ,/usr/lcaol/etc/*.conf .. These files are the best SCHG flag .. Chflags Detailed Us, please refer to Man Chflags .. 29 Talk about the software installation path .. FreeBSD is very heavy for the concept of the file directory, what kind of file must be placed in that directory, which is different from other UNIX-Like systems .. Generally we divide the software installation into two Part of part, here to explore the software to install it .. When installing the software,
Usually, such as execution files, setting files, man file, doc files are usually installed .. 1. Install the software installed when installing the system is usually installed / bin, / sbin, / usr / bin, / usr / sbin, / usr / libexec Settings Files in / etc Directory Man file typically in / usr / man or / usr / share / man doc files Usually under / usr / share / doc 2. Software executive via package or port installation Typically in / usr / local / bin, / usr / local / sbin, / usr / local / libexec Settings files under / us / local / etc directory MAN file is usually in / usr / local / man.. DOC files are usually not absolute under / usr / share / doc (so I usually use usually .. ^), because some special cases are required to focus software .. So sometimes cause a little trouble, because SSH Most of them are installed when systematic, then how to do when upgrading the new version .. Since FreeBSD finds the executive file, find the $ PATH environment variable, because / bin, / sbin, / usr / bin , / Usr / sbin ratio / usr / local / bin or / usr / local / sbin first, so will be executed first .. that is, first caught the old version of the executive file. Therefore, pay attention to this situation when updating, so as not to update Still performing an old program. So how do you see the installation path of the relevant file when you have a procedure? There is usually the following method 1. Look at the PKG-PLIST file 2. Sometimes you can see some important files in MAN [Enforcement Name] 3. View instruction file, usually in / usr / local / share / doc directory 30 How to add an IP address in FreeBSD Same IP, I need to add IP to the same network card to achieve some special requirements .. In FreeBSD, it is very simple, assume the original network card IP 211.211 . 211.211, I want to add a 211.211.211.212, using the RL0 network card, the practice is as follows ..1. In /etc/rc.conf plus this line ifconfig_rl0_alias0 = "inet 211.211.21.212 Netmask 25555.255.255" Alias0 is the first IP installed. If you want to set a plurality of ALIAS1, Alias2 .. AliaSn 2. Reactivate the network card, execute / etc / netstart # / etc / netstart 31, simple Encrypt your information In practice, we often need to encrypt some sensitive information, usually we can use the PGP or Crypt here to achieve this feature .. Crypt is through | this pipe conversion function and password setting Decomposition of encrypted features, that is to say that the password you set is used as a random number generated by encryption. First explain the method of use of Crypt [-s] [-k] [Password] General-S and -k parameters You can not pay attention, password is the encrypted or decrypted password here assumes that we first generate a Test.txt file, the content is Test, then use 1234 this password encrypted # cat> test.txt test Press Ctrl D store to take a look at Test. TXT content # more test.txt test Test.txt This file is encrypted with 1234, you need to match the pipeline | In this way, a encrypted file TEST2.TXT will be generated.
In addition, the password can be not entered first, press the Enter key to display the Enter Key: Let you enter your password, let's take a look at the encrypted file content, originally the test result turned into: # more test2.txt E & H => It is no original Test then unspeak the test2.txt, as follows, assuming the unlocked file name TEST3.TXT: # cyprpt 1234
ALL Except can be used to enhance the defined range 3. If the source, such as all, 61.219.230., Local, console, .bad.com .., etc., you can make your system more secure .. Detailed usage can be man login.access .. 34, one ./ test, when executing executable files in the current directory in Nix-Like, must add ./ These two symbols, many unix-like beginners I don't feel uncomfortable because it is not the case in the DOS or Windows DOS window .. In fact, this setting in Unix-Like has its security consideration, when using instructions or execution files, it is generally recommended for complete Directory, for example, you want to use LS, as follows: # / bin / ls of course, you can directly enter your LS, which can be implemented correctly, because you use the environment variable $ PATH in the shell .. You can type Echo $ PATH To see the current setting of $ PATH, when we execute an instruction, the system will search for this executive file according to this environment variable .. The memory shell will not put the current directory. Add to $ PATH, so if you I want to execute the execution file in this directory instead of the execution file instead of ./, can be in your shell. Join .. If you usually use TCSH, you can edit the .cshrc files under the personal home directory. SET PATH = (........ Join here .. Remember to re-exit the shell and log in to make your new settings take effect. 35, in the prompt list [users] Directory (You can play a lot of PWDs) # CD / root editing .cshrc # set proMpt = "'Hostname -s' #" ### find this line and Mark gets set Prompt = "[% n]% / #" # ## Add this row and store the disk left # logout login: root .... Log in PS. Is other user ID to be taken? I haven't tried it yet .. Just installed FreeBSD 36, RM is a file RM - RM - R is DEL's entire directory 37, introduces some useful parameters (note case) ..% B represents high brightness% N representative Name% M Master Name% / Current directory usually we may be more than saying more than, such as I want to manage several FreeBSD hosts, then the above parameters are very important. For example, if I want to change my Prompt to this, and high brightness display: User name @ Host Name [directory name]> The setting of Prompt should be like this .. set proMpt = " % B% n @% m [% /]> "Note = There is a blank, otherwise it will be wrong, resulting in unable to log in, and if you want to unify all users' Prompt, except for the change / home / user /. In addition to CSHRC, it is best to set this line in /etc/csh.cshrc, and if you want to add new users, please use this prompt, please add it in /usr/share/skel/dot.cshrc. (Or changed) this line, this is because TCSH will first refer to /etc/csh.cshrc file, and then grasp the .cshrc under its home directory, and set / usr / share / skel /dot.cshrc is automatically set to set Prompt = "% b% n @% b% n @