PATH is an environment variable in Linux and other Unix-like operating system, responsible for searching executable files in pre-defined directory. For example: 'ls' command will execute 'ls' in the path '/bin/ls'. To see all your environmental variables, type: > env If you just want to show PATH in your environmental settings, type: > env | grep PATH or, > echo $PATH The dollar sign tells echo to repeat the value of the variable PATH rather than its name. When a new system is installed, there are normally two users: a root and a ordinary public user. The root user has more directory in PATH than ordinary user, for example, it has: '/sbin' and '/usr/sbin' with the former storing system booting info and latter storing executable files. To add path to PATH, use command, > PATH="directory:$PATH" , or > export PATH=$PATH:/usr/sbin For example, to add '/usr/sbin' in the PATH, we do, > PATH="/usr/sbin:$PATH" To add it permanently, we need to specify that in '.bash_profile' existing in your home directory. To open it, use command, > vi .bash_profile Then you will see something like: If you want to add a path '/usr/test' to PATH, change the third line to: PATH=$PATH:$HOME/bin:/usr/test REFERENCE: 1. http://www.linfo.org/path_env_var.html ---------------------------------------------------------------------------------------------------------------------- 我们尊重原创,也注重分享,文章来源于微信公众号:科技前沿追踪,建议关注公众号查看原文。如若侵权请联系qter@qter.org。 ---------------------------------------------------------------------------------------------------------------------- |