FreeBSD学习笔记03-默认搜索路径
2008-06-12 14:53
295 查看
Default Search Path
When you type a command at the command prompt, FreeBSD looks in a list of directories for the name of the command you entered and runs the program if a match is found. This list of directories is called the default search path or path environment variable.
The order in which FreeBSD searches this path is important when installing third-party software, which this book concentrates on. Most third-party program files are put into subdirectories of /usr/local. The default position of the /usr/local directory is near the end of the path statement. If a command that is part of a third-party application has the same name as a command that is part of the base FreeBSD command set, it will never run because the FreeBSD command will be found first and always take precedence. Since we'll be installing third-party applications to extend and/or update FreeBSD's base system, it is beneficial to invert the order of the search path. Let's change the order of the default search path for the root user using Easy Editor:
We'll comment out (disable) the default set path statement and enter our own customized one. Scroll down to the set path) to disable it, then add the alternative path below so that your third-party programs will run even if they have the same names as native FreeBSD commands. The set path statement should now appear as follows:
Note: The text is wrapped above but each set path statement should only occupy a single line in the .cshrc file.
Save, exit, log out, and log in. You can display the current search path with this command:
By default, non-root users use the sh shell (interface), and root defaults to the tcsh shell. The default search path can be modified for non-root users in the same way. The sh shell stores this setting in the .profile file of each user's home directory.
When you type a command at the command prompt, FreeBSD looks in a list of directories for the name of the command you entered and runs the program if a match is found. This list of directories is called the default search path or path environment variable.
The order in which FreeBSD searches this path is important when installing third-party software, which this book concentrates on. Most third-party program files are put into subdirectories of /usr/local. The default position of the /usr/local directory is near the end of the path statement. If a command that is part of a third-party application has the same name as a command that is part of the base FreeBSD command set, it will never run because the FreeBSD command will be found first and always take precedence. Since we'll be installing third-party applications to extend and/or update FreeBSD's base system, it is beneficial to invert the order of the search path. Let's change the order of the default search path for the root user using Easy Editor:
# cd /root # ee .cshrc
We'll comment out (disable) the default set path statement and enter our own customized one. Scroll down to the set path) to disable it, then add the alternative path below so that your third-party programs will run even if they have the same names as native FreeBSD commands. The set path statement should now appear as follows:
#set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin /usr/X11R6/bin) set path = (/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin $HOME/bin)
Note: The text is wrapped above but each set path statement should only occupy a single line in the .cshrc file.
Save, exit, log out, and log in. You can display the current search path with this command:
# echo $path
By default, non-root users use the sh shell (interface), and root defaults to the tcsh shell. The default search path can be modified for non-root users in the same way. The sh shell stores this setting in the .profile file of each user's home directory.
相关文章推荐
- Ext.net mvc 入门学习笔记 (二) MVC4 默认引导路径的设置
- Python学习笔记(2)—搜索路径
- 【Matlab学习笔记】(三)matlab的搜索顺序和搜索路径
- Python学习笔记-模块介绍(三)-模块包和搜索路径
- 【python学习笔记】模块导入的搜索路径顺序是什么?
- 遗传算法与直接搜索工具箱学习笔记 二-----编写自己的目标函数
- 【学习笔记】避免EditText组件默认获得焦点弹出软键盘
- 遗传算法与直接搜索工具箱学习笔记(补充)三维立体绘图方法
- 搜索-Lucene学习笔记
- 遗传算法与直接搜索工具箱学习笔记 四-----从直接搜索算法开始
- WPF-学习笔记 获取我的文档路径
- 嵌入式linux c 学习笔记4-深度优先搜索和广义优先搜索
- [转载]SharePoint 2013搜索学习笔记之自定义结果源
- Python学习3:搜索路径和模块
- Programming in Objective C学习笔记03——多态、动态绑定和动态类型
- 算法学习笔记——Dijkstra单源最短路径算法
- 【IOS学习笔记】UITableView点击后取消默认选择背景色
- Java递归打印文件(夹)路径【Java学习笔记】
- 遗传算法与直接搜索工具箱学习笔记 三-----目标函数的约束