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常用命令的英文单词缩写 命令缩 ...
随机推荐
- 【Leetcode_easy】849. Maximize Distance to Closest Person
problem 849. Maximize Distance to Closest Person solution1: class Solution { public: int maxDistToCl ...
- 海思HI2115芯片-NB-IOT模块向外发短信测试
1. 说是有短信这个功能,测试下怎么使用?先使能BIP功能 AT+NCONFIG=ENABLE_BIP,TRUE 给SIM卡上电 AT+NUICC= 查询下短信中心服务号码 AT+CSCA? 发送短信 ...
- 简简单单储存过程——循环一个select结果集
原文地址:https://shitou521.iteye.com/blog/1069027 摘要:本文主要讲解了存储过程的创建.调用.以及游标的使用 ,相信掌握了游标 会对你有不错的帮助,有 ...
- 安装Windows和Ubuntu双系统
发现关注消息 安装Windows和Ubuntu双系统 安装Windows和Ubuntu双系统 0.552016.12.10 15:54:41字数 2101阅读 6644 这几天开始动手做毕设啦 ...
- windows修改系统登录密码后,出现SQLserver服务无法启动,启动报错17051
windows修改系统登录密码后,出现SQLserver服务无法启动,启动报错17051具体报错如下: 根据错误提示,去到windows的事件查看器.在win10上,右击左下角的菜单图标:然后依次点击 ...
- 虚拟机中使用Samba实现文件共享
首先我们给虚拟机安装samba服务(如果搭的是别的仓库记得开仓库) 输入命令:yum install samba samba服务的配置文件在,我们来看一下/etc/samba/smb.conf 输入命 ...
- Ubuntu中打开Qt creator,提示无法覆盖文件 /home/username/.config/Nokia/qtversion.xml : Permission denied
官网下载qt*.run文件安装后 打开Qt creator,提示无法覆盖文件 /home/username/.config/Nokia/qtversion.xml : Permission denie ...
- Centos7.5 添加环境变量并生效
配置环境变量用户 jiangshan为例(base) [jiangshan@localhost ~]$ export PATH=$PATH:/usr/local/MATLAB/R2014a/bin/( ...
- phpstrom xdebug phpstudy调试,跳不到设置断点的原因,以及配置方法
设置的是127 的地址,而用localhost 方式请求,所以无法跳到断点 环境 phpstudy 2018 php 7.2.10 xdebug版本 (因为要与php版本要对应,注意别选错了,我的用的 ...
- Python——成员变量
一.类变量 在类命名空间内定义的变量就属于类变量,python允许使用类来修改.读取类变量. 例: class a: b = '我是类变量' def c(self): print (a.b) # 通过 ...