ÏàʶLinux Bashrc£º¹¦Ð§¡¢ÉèÖÃÓëʹÓÃÒªÁì
ÏàʶLinux Bashrc£º¹¦Ð§¡¢ÉèÖÃÓëʹÓÃÒªÁì
ÔÚLinuxϵͳÖУ¬Bashrc£¨Bourne Again Shell run commands£©ÊÇÒ»¸öºÜÊÇÖ÷ÒªµÄÉèÖÃÎļþ£¬ÆäÖаüÀ¨ÁËϵͳÆô¶¯Ê±×Ô¶¯ÔËÐеÄÖÖÖÖÏÂÁîºÍÉèÖá£BashrcÎļþͨ³£Î»ÓÚÓû§µÄ¼ÒĿ¼Ï£¬ÊÇÒ»¸öÒþ²ØÎļþ£¬ËüµÄ×÷ÓÃÊÇΪÓû§×Ô½ç˵ÉèÖÃBash shellµÄÇéÐΡ£
Ò»¡¢BashrcµÄ¹¦Ð§
ÉèÖÃÇéÐαäÁ¿£ºÍ¨¹ýÔÚBashrcÎļþÖнçÌÖÇéÐαäÁ¿£¬¿ÉÒÔÔÚÿ´Î·¿ªÖÕ¶Ëʱ×Ô¶¯¼ÓÔØÕâЩ±äÁ¿£¬Àû±ãÓû§ÔÚÖÕ¶ËÖÐʹÓá£
×Ô½ç˵ÓÖÃû£º¿ÉÒÔÔÚBashrcÎļþÖÐÉèÖÃÓÖÃû£¬½«³¤ÊÙÁîת»»³É¼ò¶ÌÒ׼ǵÄÓÖÃû£¬ÔÚÖÕ¶ËÖиüÀû±ãµØŲÓá£
Ìí¼Ó×Ô½ç˵º¯Êý£º¿ÉÒÔÔÚBashrcÎļþÖнç˵×Ô¼ºµÄº¯Êý£¬Àû±ãÔÚÖÕ¶ËÖÐʹÓã¬ÊµÏÖһЩ¶¨ÖÆ»¯µÄ¹¦Ð§¡£
ÐÞ¸ÄÌáÐÑ·û£º¿ÉÒÔÔÚBashrcÎļþÖÐÐÞ¸ÄÌáÐÑ·ûµÄÑùʽºÍÑÕÉ«£¬ÃÀ»¯Öն˽çÃæ¡£
¶þ¡¢ÉèÖÃBashrc
ҪʹÓÃBashrcÎļþ£¬Ê×ÏÈÐèÒª±à¼¸ÃÎļþ£¬¿ÉÒÔʹÓÃÈκÎÎı¾±à¼Æ÷·¿ª¡£³£¼ûµÄ·½·¨ÊÇʹÓÃÏÂÁîÐбà¼Æ÷£¬ºÃ±ÈʹÓÃvim»òÕßnano±à¼Æ÷¡£
vim ~/.bashrc
µÇ¼ºó¸´ÖÆ
±à¼BashrcÎļþʱ£¬¿ÉÒÔƾ֤ÏÂÃæµÄʾÀý¾ÙÐÐÉèÖãº
ÉèÖÃÇéÐαäÁ¿£º
export PATH=$PATH:/opt/bin export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
µÇ¼ºó¸´ÖÆ
ÉèÖÃÓÖÃû£º
alias ll='ls -alF'
µÇ¼ºó¸´ÖÆ
Ìí¼Ó×Ô½ç˵º¯Êý£º
function greet() { echo "Hello, $1!" }
µÇ¼ºó¸´ÖÆ
ÐÞ¸ÄÌáÐÑ·û£º
PS1="[e[1;33m][u@h W]$ [e[m]"
µÇ¼ºó¸´ÖÆ
±à¼Íê³Éºó£¬ÉúÑIJ¢Í˳ö±à¼Æ÷£¬ÖØмÓÔØBashrcÎļþʹÉèÖÃÉúЧ£º
source ~/.bashrc
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
Èý¡¢BashrcµÄʹÓÃÒªÁì
ÏÔʾĿ½ñÓû§µÄBashrcÉèÖÃÐÅÏ¢£º
cat ~/.bashrc
µÇ¼ºó¸´ÖÆ
ÐÞ¸ÄBashrcÎļþºó£¬ÈÃÐÞ¸ÄÁ¬Ã¦ÉúЧ£º
source ~/.bashrc
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
ÔÝʱ×÷·ÏijÌõÉèÖõÄÉúЧ£º
# ×¢Ê͵ôÏìÓ¦µÄÉèÖÃÏî
µÇ¼ºó¸´ÖÆ
²éÕÒÌض¨ÉèÖÃÏ
grep 'Òªº¦´Ê' ~/.bashrc
µÇ¼ºó¸´ÖÆ
ͨ¹ý¶ÔBashrcÎļþ¾ÙÐÐÉèÖ㬿ÉÒÔʹÖն˵ÄʹÓÃÔ½·¢¸ßЧºÍÀû±ã¡£ºÏÀíµÄÉèÖÿÉÒÔÌá¸ßÊÂÇéЧÂÊ£¬¶¨ÖÆ»¯µÄÉèÖÿÉÒÔÖª×ã¸öÐÔ»¯ÐèÇó¡£Ï£ÍûÒÔÉÏÄÚÈÝÄÜ×ÊÖú¸÷ÈËÏàʶLinux BashrcµÄ¹¦Ð§¡¢ÉèÖÃÓëʹÓÃÒªÁì¡£
ÒÔÉϾÍÊÇÏàʶLinux Bashrc£º¹¦Ð§¡¢ÉèÖÃÓëʹÓÃÒªÁìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡