linux¹ØÓÚbashrcÓëprofileµÄÇø±ð
bashrcÓëprofileµÄÇø±ð
Òª¸ãÇåbashrcÓëprofileµÄÇø±ð£¬Ê×ÏÈҪŪÃ÷°×ʲôÊǽ»»¥Ê½shellºÍ·Ç½»»¥Ê½shell£¬Ê²Ã´ÊÇlogin shell ºÍnon-login shell¡£
½»»¥Ê½Ä£Ê½¾ÍÊÇshellµÈ´ýÄãµÄÊäÈ룬²¢ÇÒÖ´ÐÐÄãÌá½»µÄÃüÁî¡£ÕâÖÖģʽ±»³Æ×÷½»»¥Ê½ÊÇÒòΪshellÓëÓû§½øÐн»»¥¡£ÕâÖÖģʽҲÊÇ´ó¶àÊýÓû§·Ç³£ÊìϤµÄ£ºµÇ¼¡¢Ö´ÐÐһЩÃüÁǩÍË¡£µ±ÄãÇ©Í˺ó£¬shellÒ²ÖÕÖ¹ÁË¡£ shellÒ²¿ÉÒÔÔËÐÐÔÚÁíÍâÒ»ÖÖģʽ£º·Ç½»»¥Ê½Ä£Ê½¡£ÔÚÕâÖÖģʽÏ£¬shell²»ÓëÄã½øÐн»»¥£¬¶øÊǶÁÈ¡´æ·ÅÔÚÎļþÖеÄÃüÁî,²¢ÇÒÖ´ÐÐËüÃÇ¡£µ±Ëü¶Áµ½ÎļþµÄ½á⣬shellÒ²¾ÍÖÕÖ¹ÁË¡£
bashrcÓëprofile¶¼ÓÃÓÚ±£´æÓû§µÄ»·¾³ÐÅÏ¢£¬bashrcÓÃÓÚ½»»¥Ê½non-loginshell£¬¶øprofileÓÃÓÚ½»»¥Ê½login shell¡£ÏµÍ³ÖдæÔÚÐí¶àbashrcºÍprofileÎļþ£¬ÏÂÃæÖðÒ»½éÉÜ£º
/etc/pro´ËÎļþΪϵͳµÄÿ¸öÓû§ÉèÖû·¾³ÐÅÏ¢,µ±µÚÒ»¸öÓû§µÇ¼ʱ,¸ÃÎļþ±»Ö´ÐÐ.
²¢´Ó/etc/profile.dĿ¼µÄÅäÖÃÎļþÖÐËѼ¯shellµÄÉèÖÃ.
/etc/bashrc:Ϊÿһ¸öÔËÐÐbash shellµÄÓû§Ö´ÐдËÎļþ.µ±bash shell±»´ò¿ªÊ±,¸ÃÎļþ±»¶ÁÈ¡¡£ÓÐЩlinux°æ±¾ÖеÄ/etcĿ¼ÏÂÒѾûÓÐÁËbashrcÎļþ¡£
~/. proÿ¸öÓû§¶¼¿ÉʹÓøÃÎļþÊäÈëרÓÃÓÚ×Ô¼ºÊ¹ÓõÄshellÐÅÏ¢,µ±Óû§µÇ¼ʱ,¸Ã
Îļþ½ö½öÖ´ÐÐÒ»´Î!ĬÈÏÇé¿öÏÂ,ËüÉèÖÃһЩ»·¾³±äÁ¿,È»ºóÖ´ÐÐÓû§µÄ.bashrcÎļþ.
~/.bashrc:¸ÃÎļþ°üº¬×¨ÓÃÓÚij¸öÓû§µÄbash shellµÄbashÐÅÏ¢,µ±¸ÃÓû§µÇ¼ʱÒÔ¼°Ã¿´Î´ò¿ªÐµÄshellʱ,¸ÃÎļþ±»¶ÁÈ¡.
ÁíÍâ,/etc/profileÖÐÉ趨µÄ±äÁ¿(È«¾Ö)µÄ¿ÉÒÔ×÷ÓÃÓÚÈκÎÓû§,¶ø~/.bashrcµÈÖÐÉ趨µÄ±äÁ¿(¾Ö²¿)Ö»Äܼ̳Ð/etc/profileÖеıäÁ¿,ËûÃÇÊÇ"¸¸×Ó"¹Øϵ.
ijÍøÓÑ×ܽáÈçÏ£º
/etc/profile£¬/etc/bashrc ÊÇϵͳȫ¾Ö»·¾³±äÁ¿É趨
~/.profile£¬~/.bashrcÓû§¼ÒĿ¼ÏµÄ˽Óл·¾³±äÁ¿É趨
µ±µÇÈëϵͳʱºò»ñµÃÒ»¸öshell½ø³Ìʱ£¬Æä¶ÁÈ¡»·¾³É趨µµÓÐÈý²½
1Ê×ÏȶÁÈëµÄÊÇÈ«¾Ö»·¾³±äÁ¿É趨µµ/etc/profile£¬È»ºó¸ù¾ÝÆäÄÚÈݶÁÈ¡¶îÍâµÄÉ趨µÄÎĵµ£¬Èç
/etc/profile.dºÍ/etc/inputrc
2È»ºó¸ù¾Ý²»Í¬Ê¹ÓÃÕßÕʺţ¬È¥Æä¼ÒĿ¼¶ÁÈ¡~/.bash_profile£¬Èç¹ûÕâ¶ÁÈ¡²»Á˾ͶÁÈ¡~/.bash_login£¬Õâ¸öÒ²¶ÁÈ¡²»Á˲Żá¶ÁÈ¡
~/.profile£¬ÕâÈý¸öÎĵµÉ趨»ù±¾ÉÏÊÇÒ»ÑùµÄ£¬¶ÁÈ¡ÓÐÓÅÏȹØϵ
3È»ºóÔÚ¸ù¾ÝÓû§ÕʺŶÁÈ¡~/.bashrc
ÖÁÓÚ~/.profileÓë~/.bashrcµÄ²»Çø±ð
¶¼¾ßÓиöÐÔ»¯¶¨Öƹ¦ÄÜ
~/.profile¿ÉÒÔÉ趨±¾Óû§×¨ÓеÄ·¾¶£¬»·¾³±äÁ¿£¬µÈ£¬ËüÖ»ÄܵÇÈëµÄʱºòÖ´ÐÐÒ»´Î
~/.bashrcÒ²ÊÇijÓû§×¨ÓÐÉ趨Îĵµ£¬¿ÉÒÔÉ趨Â
Ïà¹ØÎĵµ£º
This document shows how to write a daemon in Linux using GCC. Knowledge of Linux and a familiarity with C are necessary to use this document. This HOWTO is Copyright by Devin Watson, under the terms of the BSD License.
1. Introduction: What is a Daemon?
2. Getting Started
3. Planning Your Daemo ......
Ò»¸öÕýÔò±í´ïʽ¾ÍÊÇÓÉÆÕͨ×Ö·û£¨ÀýÈç×Ö·û a µ½ z£©ÒÔ¼°ÌØÊâ×Ö·û£¨³ÆΪԪ×Ö·û£©×é³ÉµÄÎÄ×Öģʽ¡£¸ÃģʽÃèÊöÔÚ²éÕÒÎÄ×ÖÖ÷Ìåʱ´ýÆ¥ÅäµÄÒ»¸ö»ò¶à¸ö×Ö·û´®¡£ÕýÔò±í´ïʽ×÷Ϊһ¸öÄ£°å£¬½«Ä³¸ö×Ö·ûģʽÓëËùËÑË÷µÄ×Ö·û´®½øÐÐÆ¥Åä¡£
¡¡¡¡½«ÏÂÒ»¸ö×Ö·û±ê¼ÇΪһ¸öÌØÊâ×Ö·û¡¢»òÒ»¸öÔÒå×Ö·û¡¢»òÒ»¸ö ºóÏòÒýÓᢻòÒ»¸ö°Ë½øÖÆתÒå·û¡£ÀýÈ ......
²»Í¬Ö®´¦Ö÷ÒªÌåÏÖÔÚ×ÅÑ۵㣺
£¨1£©UbuntuÊÇΪÁËÌá¸ßͼÐνçÃæϵÄÓû§ÌåÑé
ËùÒÔ¹¦·ò¶¼×öÔÚ¼ÒÓûúÉÏÓ²¼þ¼æÈÝÐÔ
³õ¼¶Óû§µÄÒ×ÓÃÐÔ
£¨2£©SuseÊÇΪÁËÌá¸ßÆóÒµÓû§µÄÈÏ¿É
ÐèÒª×î¸ßµÄÎȶ¨ÐÔ£¬ÈÝÒ×µÄÅäÖ÷þÎñ
¿ÉÒÔºÜÈÝÒ×ʹÓÃSuseºÍRethat´î½¨Ò»¸ö¿É¿¿µÄÍøÕ¾
£¨3£©ArchlinuxÊÇΪÁ˼ò»¯Öм¶Ó ......
ÎÒÕâÀï˵µÄioctlº¯ÊýÊÇÔÚÇý¶¯³ÌÐòÀïµÄ£¬ÒòΪÎÒ²»ÖªµÀ»¹ÓÐûÓбðµÄ³¡ºÏÓõ½ÁËioctl£¬ ËùÒԾ͹涨ÁËÎÒÃÇÌÖÂ۵ķ¶Î§¡£ÎªÊ²Ã´ÒªÐ´ÆªÎÄÕÂÄØ£¬ÊÇÒòΪÎÒÇ°Ò»Õó×Ó±»ioctl¸ø¸ã»ìÁË£¬Õ⼸Ìì²ÅŪÃ÷°×Ëü£¬ÓÚÊÇÔÚÕâÀïÇåÀíÒ»ÏÂÍ·ÄÔ¡£
Ò»¡¢ ʲôÊÇioctl¡£
ioctlÊÇÉ豸Çý¶¯³ÌÐòÖжÔÉ豸µÄI/OͨµÀ½øÐйÜÀíµÄº¯Êý¡£Ëùν¶ÔI/OͨµÀ½øÐÐ ......