Linux命令——source
前言
当我们修改了/etc/profile文件,并想让它立刻生效,而不用重新登录,就可以使用source命令,如source /etc/profile。
source命令
source是一个内建命令。下面命令执行环境是Ubuntu 16.04.3 LTS下的bash。事实上source命令并不是bash(Bourne shell)内置的,他是GNU项目后来扩展引入的。其他shell不确定是否有source命令。
Linux命令——type、which、whatis、apropos、whereis、find
root@ubuntu:~# type source
source is a shell builtin
除了type可以查看source,help命令也可以
root@ubuntu:~# help source
source: source filename [arguments]
Execute commands from a file in the current shell. Read and execute commands from FILENAME in the current shell. The
entries in $PATH are used to find the directory containing FILENAME.
If any ARGUMENTS are supplied, they become the positional parameters
when FILENAME is executed. Exit Status:
Returns the status of the last command executed in FILENAME; fails if
FILENAME cannot be read.
但是man,whatis命令就不可以查看source命令了
root@ubuntu:~# man source
No manual entry for source
root@ubuntu:~# whatis source
source: nothing appropriate.
考虑到和其他shell的兼容性,最好使用点号 . 。点号.是source的同义词,为啥使用source而不是.,可能的原因是:写.有时候看起来像是写错了的命令,用source更直观。
但是从简洁的角度看,实在没必要打那么多字来实现一个和.一样的功能
./ 和 source 不完全一样
./scriptruns the script as an executable file, launching a new shell to run itsource scriptreads and executes commands from filename in the current shell environment
Note: ./script is not . script, but . script == source script

Linux命令——source的更多相关文章
- Linux命令:source
语法 source filename 说明 . 的同义词
- Linux命令随笔
Linux命令总结 man ==命令帮助; help ==命令的帮助(bash的内置命令); ls ==list,查看目录列表; -ld:查看目录权限; -l:(long)长格式显示属性; -F:给不 ...
- 我常用的那些linux命令
我常用的那些linux命令 用linux也有些年头了,说来也忏愧,说是有些年头了,其实也还是个不长进的主.记得第一次接触linux是boss跟我说的怎么操作,什么编辑模式,按i,a,o进入编辑模式.在 ...
- Java开发必会的Linux命令
Java开发必会的Linux命令 作为一个Java开发人员,有些常用的Linux命令必须掌握.即时平时开发过程中不使用Linux(Unix)或者mac系统,也需要熟练掌握Linux命令.因为很多服务器 ...
- [z]Java开发必会的Linux命令
1.查找文件 find / -name filename.txt 根据名称查找/目录下的filename.txt文件. find . -name "*.xml" 递归查找所有的xm ...
- Linux命令整理中...
Linux命令整理中... 最常用命令(我最近最常用的一般放在前面tipsbychsry) clear 清屏 date 显示日期 cal 显示日历 cal 2014 显示2014年的日历 shutdo ...
- Linux 命令小记
1. pidof 进程名 :获取进程的pid,例如 pidof memcached 得到5333 2. unset Shell变量 :取消设置一个shell变量,从内存和shell的导出环境中删除它, ...
- LINUX命令总结 -------来自 水滴娃娃 的CSDN
LINUX命令总结 标签: LINUX命令总结 2014-01-27 15:54 41039人阅读 评论(1) 收藏 举报 分类: linux(1) 版权声明:本文为博主原创文章,未经博主允许不得 ...
- [Android ] linux命令英文缩写的含义(方便记忆)
du -sh */ reference to : http://blog.chinaunix.net/uid-27164517-id-3299073.html linux常用命令的英文单词缩写 命令缩 ...
随机推荐
- Python - Django - ORM 一对一表结构
当一张表的某一些字段查询的比较频繁,另外一些字段查询的不是特别频繁,可以把不怎么常用的字段 单独拿出来做成一张表,然后用一对一的表关联起来 这样既保证数据都完整的保存下来,又能保证检索更快 model ...
- Dockerfile-server2
[root@lab2 docker-file]# cd server2/ [root@lab2 server2]# ls ddbes-server2-0.0.1-SNAPSHOT.jar Docker ...
- C# .NET UDP 形式调用 graylog,gelf
-- 发送: GelfLogModel m = new GelfLogModel(); m.version = "1.1"; m.host = "128.0.14.39& ...
- Andrew Ng机器学习课程10补充
Andrew Ng机器学习课程10补充 VC dimension 讲到了如果通过最小化训练误差,使用一个具有d个参数的hypothesis class进行学习,为了学习好,一般需要参数d的线性关系个训 ...
- js 上传txt格式文件
判断文件是否为.txt格式: $(".delbao .file").on("change",function(){ var acceptType = $(thi ...
- Python机器学习基础教程-第1章-鸢尾花的例子KNN
前言 本系列教程基本就是摘抄<Python机器学习基础教程>中的例子内容. 为了便于跟踪和学习,本系列教程在Github上提供了jupyter notebook 版本: Github仓库: ...
- SSH连接服务器时,长时间不操作就会断开的解决方案
最近在配置服务器相关内容时候,不同的事情导致长时间不操作,页面就断开了连接,不能操作,只能关闭窗口,最后通过以下命令解决. SSH连接linux时,长时间不操作就断开的解决方案: 1.修改/etc/s ...
- Django orm练习
ORM练习题 models生成 from django.db import models # Create your models here. # 书籍管理 class Book(models.Mod ...
- 通过减少 IO 实现性能的优化
原始地址见 这里 本文是工作中一点点简单的思考,不能保证是完全正确的,可能也仅仅是适用于部分场景. 场景 1:获取用户关注的好友列表中,每个好友的名字.头像等信息. 在很多公司中,不同的服务是由不同的 ...
- python基础学习(七)
14.return # print() 可以被执行 def doubelNumber(num): print() print() Afnum = doubelNumber() print(Afnum) ...