×ðÁú¿­Ê±¹ÙÍøµÇ¼

6ÖÖÒªÁìÉèÖÃLinuxÇéÐαäÁ¿ £¬ÄÄÖÖ¸üË¿»¬£¿

LinuxÇéÐαäÁ¿ÉèÖÃ

ÔÚ×Ô½ç˵װÖÃÈí¼þµÄʱ¼ä £¬¾­³£ÐèÒªÉèÖÃÇéÐαäÁ¿ £¬ÏÂÃæö¾Ù³öÖÖÖÖ¶ÔÇéÐαäÁ¿µÄÉèÖÃÒªÁì¡£

ÏÂÃæËùÓÐÀý×ÓµÄÇéÐÎ˵Ã÷ÈçÏ£º

ϵͳ£ºUbuntu 14.0

Óû§Ãû£ºuusama

ÐèÒªÉèÖÃMySQLÇéÐαäÁ¿Â·¾¶£º/home/uusama/mysql/bin

Linux¶ÁÈ¡ÇéÐαäÁ¿

¶ÁÈ¡ÇéÐαäÁ¿µÄÒªÁ죺

exportÏÂÁîÏÔʾĿ½ñϵͳ½ç˵µÄËùÓÐÇéÐαäÁ¿

echo $PATHÏÂÁîÊä³öÄ¿½ñµÄPATHÇéÐαäÁ¿µÄÖµ

ÕâÁ½¸öÏÂÁîÖ´ÐеÄЧ¹ûÈçÏÂ

uusama@ubuntu:~exportdeclare -x HOME="/home/uusama"declare -x LANG="en_US.UTF-8"declare -x LANGUAGE="en_US:"declare -x LESSCLOSE="/usr/bin/lesspipe %s %s"declare -x LESSOPEN="| /usr/bin/lesspipe %s"declare -x LOGNAME="uusama"declare -x MAIL="/var/mail/uusama"declare -x PATH="/home/uusama/bin:/home/uusama/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"declare -x SSH_TTY="/dev/pts/0"declare -x TERM="xterm"declare -x USER="uusama"uusama@ubuntu:~ echo $PATH/home/uusama/bin:/home/uusama/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

µÇ¼ºó¸´ÖÆ

ÆäÖÐPATH±äÁ¿½ç˵ÁËÔËÐÐÏÂÁîµÄ²éÕÒ·¾¶ £¬ÒÔðºÅ:Ö§½â²î±ðµÄ·¾¶ £¬Ê¹ÓÃexport½ç˵µÄʱ¼ä¿É¼ÓË«ÒýºÅÒ²¿É²»¼Ó¡£

LinuxÇéÐαäÁ¿ÉèÖÃÒªÁìÒ»£ºexport PATH

ʹÓÃexportÏÂÁîÖ±½ÓÐÞ¸ÄPATHµÄÖµ £¬ÉèÖÃMySQL½øÈëÇéÐαäÁ¿µÄÒªÁì:

export PATH=/home/uusama/mysql/bin:PATH# »òÕß°ÑPATH·ÅÔÚÇ°Ãæexport PATH=PATH:/home/uusama/mysql/bin

µÇ¼ºó¸´ÖÆ

×¢ÖØÊÂÏ

ÉúЧʱ¼ä£ºÁ¬Ã¦ÉúЧ

ÉúЧÏÞÆÚ£ºÄ¿½ñÖÕ¶ËÓÐÓà £¬´°¿Ú¹Ø±ÕºóÎÞЧ

ÉúЧ¹æÄ££º½ö¶ÔÄ¿½ñÓû§ÓÐÓÃ

ÉèÖõÄÇéÐαäÁ¿Öв»ÒªÍüÁ˼ÓÉÏÔ­À´µÄÉèÖà £¬¼´$PATH²¿·Ö £¬×èÖ¹ÁýÕÖÔ­À´ÉèÖÃ

LinuxÇéÐαäÁ¿ÉèÖÃÒªÁì¶þ£ºvim ~/.bashrc

ͨ¹ýÐÞ¸ÄÓû§Ä¿Â¼ÏµÄ~/.bashrcÎļþ¾ÙÐÐÉèÖãº

vim ~/.bashrc# ÔÚ×îºóÒ»ÐмÓÉÏexport PATH=$PATH:/home/uusama/mysql/bin

µÇ¼ºó¸´ÖÆ

×¢ÖØÊÂÏ

ÉúЧʱ¼ä£ºÊ¹ÓÃÏàͬµÄÓû§·­¿ªÐµÄÖÕ¶ËʱÉúЧ £¬»òÕßÊÖ¶¯source ~/.bashrcÉúЧ

ÁíÍâ £¬ËÑË÷ÃñÖÚºÅLinux¾Í¸ÃÕâÑùѧºǫ́»Ø¸´¡°Linux¡± £¬»ñÈ¡Ò»·Ý¾ªÏ²Àñ°ü¡£

ÉúЧÏÞÆÚ£ºÓÀÊÀÓÐÓÃ

ÉúЧ¹æÄ££º½ö¶ÔÄ¿½ñÓû§ÓÐÓÃ

ÈôÊÇÓкóÐøµÄÇéÐαäÁ¿¼ÓÔØÎļþÁýÕÖÁËPATH½ç˵ £¬Ôò¿ÉÄܲ»ÉúЧ

LinuxÇéÐαäÁ¿ÉèÖÃÒªÁìÈý£ºvim ~/.bash_profile

ºÍÐÞ¸Ä~/.bashrcÎļþÀàËÆ £¬Ò²ÊÇÒªÔÚÎļþ×îºó¼ÓÉÏеķ¾¶¼´¿É£º

vim ~/.bash_profile# ÔÚ×îºóÒ»ÐмÓÉÏexport PATH=$PATH:/home/uusama/mysql/bin

µÇ¼ºó¸´ÖÆ

×¢ÖØÊÂÏ

ÉúЧʱ¼ä£ºÊ¹ÓÃÏàͬµÄÓû§·­¿ªÐµÄÖÕ¶ËʱÉúЧ £¬»òÕßÊÖ¶¯source ~/.bash_profileÉúЧ

ÉúЧÏÞÆÚ£ºÓÀÊÀÓÐÓÃ

ÉúЧ¹æÄ££º½ö¶ÔÄ¿½ñÓû§ÓÐÓÃ

ÈôÊÇûÓÐ~/.bash_profileÎļþ £¬Ôò¿ÉÒԱ༭~/.profileÎļþ»òÕßн¨Ò»¸ö

LinuxÇéÐαäÁ¿ÉèÖÃÒªÁìËÄ£ºvim /etc/bashrc

¸ÃÒªÁìÊÇÐÞ¸ÄϵͳÉèÖà £¬ÐèÒªÖÎÀíԱȨÏÞ£¨Èçroot£©»òÕ߶ԸÃÎļþµÄдÈëȨÏÞ£º

# ÈôÊÇ/etc/bashrcÎļþ²»¿É±à¼­£¬ÐèÒªÐÞ¸ÄΪ¿É±à¼­chmod -v u+w /etc/bashrcvim /etc/bashrc# ÔÚ×îºóÒ»ÐмÓÉÏexport PATH=$PATH:/home/uusama/mysql/bin

µÇ¼ºó¸´ÖÆ

×¢ÖØÊÂÏ

ÉúЧʱ¼ä£ºÐ¿ªÖÕ¶ËÉúЧ £¬»òÕßÊÖ¶¯source /etc/bashrcÉúЧ

ÉúЧÏÞÆÚ£ºÓÀÊÀÓÐÓÃ

ÉúЧ¹æÄ££º¶ÔËùÓÐÓû§ÓÐÓÃ

LinuxÇéÐαäÁ¿ÉèÖÃÒªÁìÎ壺vim /etc/profile

¸ÃÒªÁìÐÞ¸ÄϵͳÉèÖà £¬ÐèÒªÖÎÀíԱȨÏÞ»òÕ߶ԸÃÎļþµÄдÈëȨÏÞ £¬ºÍvim /etc/bashrcÀàËÆ£º

# ÈôÊÇ/etc/profileÎļþ²»¿É±à¼­£¬ÐèÒªÐÞ¸ÄΪ¿É±à¼­chmod -v u+w /etc/profilevim /etc/profile# ÔÚ×îºóÒ»ÐмÓÉÏexport PATH=$PATH:/home/uusama/mysql/bin

µÇ¼ºó¸´ÖÆ

×¢ÖØÊÂÏ

ÉúЧʱ¼ä£ºÐ¿ªÖÕ¶ËÉúЧ £¬»òÕßÊÖ¶¯source /etc/profileÉúЧ

ÉúЧÏÞÆÚ£ºÓÀÊÀÓÐÓÃ

ÉúЧ¹æÄ££º¶ÔËùÓÐÓû§ÓÐÓÃ

LinuxÇéÐαäÁ¿ÉèÖÃÒªÁìÁù£ºvim /etc/environment

¸ÃÒªÁìÊÇÐÞ¸ÄϵͳÇéÐÎÉèÖÃÎļþ £¬ÐèÒªÖÎÀíԱȨÏÞ»òÕ߶ԸÃÎļþµÄдÈëȨÏÞ£º

# ÈôÊÇ/etc/bashrcÎļþ²»¿É±à¼­£¬ÐèÒªÐÞ¸ÄΪ¿É±à¼­chmod -v u+w /etc/environmentvim /etc/profile# ÔÚ×îºóÒ»ÐмÓÉÏexport PATH=$PATH:/home/uusama/mysql/bin

µÇ¼ºó¸´ÖÆ

×¢ÖØÊÂÏ

ÉúЧʱ¼ä£ºÐ¿ªÖÕ¶ËÉúЧ £¬»òÕßÊÖ¶¯source /etc/environmentÉúЧ

ÉúЧÏÞÆÚ£ºÓÀÊÀÓÐÓÃ

ÉúЧ¹æÄ££º¶ÔËùÓÐÓû§ÓÐÓÃ

LinuxÇéÐαäÁ¿¼ÓÔØÔ­ÀíÆÊÎö

ÉÏÃæÁгöÁËÇéÐαäÁ¿µÄÖÖÖÖÉèÖÃÒªÁì £¬ÄÇôLinuxÊÇÔõÑù¼ÓÔØÕâЩÉèÖõÄÄØ£¿ÊÇÒÔʲôÑùµÄ˳Ðò¼ÓÔصÄÄØ£¿

Å£±Æ°¡£¡½Ó˽»î±Ø±¸µÄ N ¸ö¿ªÔ´ÏîÄ¿£¡¸ÏæÕä²Ø

µÇ¼ºó¸´ÖÆ

Ìض¨µÄ¼ÓÔØ˳Ðò»áµ¼ÖÂÏàͬÃû³ÆµÄÇéÐαäÁ¿½ç˵±»ÁýÕÖ»òÕß²»ÉúЧ¡£

ÇéÐαäÁ¿µÄ·ÖÀà

ÇéÐαäÁ¿¿ÉÒÔ¼òÆӵķֳÉÓû§×Ô½ç˵µÄÇéÐαäÁ¿ÒÔ¼°ÏµÍ³¼¶±ðµÄÇéÐαäÁ¿¡£

Óû§¼¶±ðÇéÐαäÁ¿½ç˵Îļþ£º~/.bashrc¡¢~/.profile£¨²¿·ÖϵͳΪ£º~/.bash_profile£©

ϵͳ¼¶±ðÇéÐαäÁ¿½ç˵Îļþ£º/etc/bashrc¡¢/etc/profile(²¿·ÖϵͳΪ£º/etc/bash_profile£©¡¢/etc/environment ÁíÍâÔÚÓû§ÇéÐαäÁ¿ÖÐ £¬ÏµÍ³»áÊ×ÏȶÁÈ¡~/.bash_profile£¨»òÕß~/.profile£©Îļþ £¬ÈôÊÇûÓиÃÎļþÔò¶ÁÈ¡~/.bash_login £¬Æ¾Ö¤ÕâЩÎļþÖÐÄÚÈÝÔÙÈ¥¶ÁÈ¡~/.bashrc¡£

²âÊÔLinuxÇéÐαäÁ¿¼ÓÔØ˳ÐòµÄÒªÁì

ΪÁ˲âÊÔ¸÷¸ö²î±ðÎļþµÄÇéÐαäÁ¿¼ÓÔØ˳Ðò £¬ÎÒÃÇÔÚÿ¸öÇéÐαäÁ¿½ç˵ÎļþÖеĵÚÒ»Ðж¼½ç˵ÏàͬµÄÇéÐαäÁ¿UU_ORDER £¬¸Ã±äÁ¿µÄֵΪ×Ô¼ºµÄÖµÅþÁ¬ÊÜÆ­Ç°ÎļþÃû³Æ¡£

ÐèÒªÐ޸ĵÄÎļþÈçÏ£º

/etc/environment

/etc/profile

/etc/profile.d/test.sh £¬Ð½¨Îļþ £¬Ã»ÓÐÎļþ¼Ð¿ÉÂÔ¹ý

/etc/bashrc £¬»òÕß/etc/bash.bashrc

~/.bash_profile £¬»òÕß~/.profile

~/.bashrc

ÔÚÿ¸öÎļþÖеĵÚÒ»Ðж¼¼ÓÉÏÏÂÃæÕâ¾ä´úÂë £¬²¢ÏìÓ¦µÄ°ÑðºÅºóµÄÄÚÈÝÐÞ¸ÄΪĿ½ñÎļþµÄ¾ø¶ÔÎļþÃû¡£

export UU_ORDER="$UU_ORDER:~/.bash_profile"

µÇ¼ºó¸´ÖÆ

ÐÞ¸ÄÍêÖ®ºóÉúÑÄ £¬Ð¿ªÒ»¸ö´°¿Ú £¬È»ºóecho $UU_ORDERÊÓ²ì±äÁ¿µÄÖµ£º

uusama@ubuntu:~echoUU_ORDER
$UU_ORDER:/etc/environment:/etc/profile:/etc/bash.bashrc:/etc/profile.d/test.sh:~/.profile:~/.bashrc

µÇ¼ºó¸´ÖÆ

¿ÉÒÔÍƲâ³öLinux¼ÓÔØÇéÐαäÁ¿µÄ˳ÐòÈçÏ£º

/etc/environment

/etc/profile

/etc/bash.bashrc

/etc/profile.d/test.sh

~/.profile

~/.bashrc

LinuxÇéÐαäÁ¿Îļþ¼ÓÔØÏê½â

ÓÉÉÏÃæµÄ²âÊÔ¿ÉÈÝÒ׵óöLinux¼ÓÔØÇéÐαäÁ¿µÄ˳ÐòÈçÏ £¬£º

ϵͳÇéÐαäÁ¿ -> Óû§×Ô½çÌÖÇéÐαäÁ¿ /etc/environment -> /etc/profile -> ~/.profile

·­¿ª/etc/profileÎļþÄã»á·¢Ã÷ £¬¸ÃÎļþµÄ´úÂëÖлá¼ÓÔØ/etc/bash.bashrcÎļþ £¬È»ºó¼ì²é/etc/profile.d/Ŀ¼ÏµÄ.shÎļþ²¢¼ÓÔØ¡£ÁíÍâ £¬ËÑË÷ÃñÖÚºÅLinux¾Í¸ÃÕâÑùѧºǫ́»Ø¸´¡°Linux¡± £¬»ñÈ¡Ò»·Ý¾ªÏ²Àñ°ü¡£

# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "PS1" ]; then
  if [ "BASH" ] && [ "BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1=' '
    fi
  fi
fi

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r i ]; then
      .i
    fi
  done
  unset i
fi

µÇ¼ºó¸´ÖÆ

Æä´ÎÔÙ·­¿ª~/.profileÎļþ £¬»á·¢Ã÷¸ÃÎļþÖмÓÔØÁË~/.bashrcÎļþ¡£

# if running bash
if [ -n "BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "HOME/.bashrc" ]; then
    . "HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin directories
PATH="HOME/bin:HOME/.local/bin:PATH"

µÇ¼ºó¸´ÖÆ

´Ó~/.profileÎļþÖдúÂë²»ÄÑ·¢Ã÷ £¬/.profileÎļþÖ»ÔÚÓû§µÇ¼µÄʱ¼ä¶ÁÈ¡Ò»´Î £¬¶ø/.bashrc»áÔÚÿ´ÎÔËÐÐShell¾ç±¾µÄʱ¼ä¶ÁÈ¡Ò»´Î¡£

һЩС¼¼ÇÉ

¿ÉÒÔ×Ô½ç˵һ¸öÇéÐαäÁ¿Îļþ £¬ºÃ±ÈÔÚij¸öÏîĿϽç˵uusama.profile £¬ÔÚÕâ¸öÎļþÖÐʹÓÃexport½ç˵һϵÁбäÁ¿ £¬È»ºóÔÚ~/.profileÎļþºóÃæ¼ÓÉÏ£ºsourc uusama.profile £¬ÕâÑùÄãÿ´ÎÉÏ°¶¶¼¿ÉÒÔÔÚShell¾ç±¾ÖÐʹÓÃ×Ô¼º½ç˵µÄһϵÁбäÁ¿¡£

Ò²¿ÉÒÔʹÓÃaliasÏÂÁî½ç˵һЩÏÂÁîµÄÓÖÃû £¬ºÃ±Èalias rm=”rm -i”£¨Ë«ÒýºÅ±ØÐ裩 £¬²¢°ÑÕâ¸ö´úÂë¼ÓÈëµ½~/.profileÖÐ £¬ÕâÑùÄãÿ´ÎʹÓÃrmÏÂÁîµÄʱ¼ä £¬¶¼Ï൱ÓÚʹÓÃrm -iÏÂÁî £¬ºÜÊÇÀû±ã¡£

ÒÔÉϾÍÊÇ6ÖÖÒªÁìÉèÖÃLinuxÇéÐαäÁ¿ £¬ÄÄÖÖ¸üË¿»¬£¿µÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ