hash命令详解用法

发布时间:2020-08-01 16:43:55 作者:wx5a1f8d23790cb
来源:网络 阅读:148

for each name,the full file name of command is determined by searching the directories in $PATH and remembered.
对于每一个hash命令中的参数name,命令的完整文件名被从$PATH中搜寻到的目录的决定,然后hash命令记住这一结果。
hash [-p filename]
If the -p option is supplied,no path search is performed,and filename is used as the full file name of the command.
如果提供了-p选项,不执行路径搜索,将命令全路径path起别名为name

     the  -r  option causes the shell  to forget  allrembered locations
     -r选项发使shell忘记所有已经记住的位置
     the -d option cause the shell to forget location  of  each name
     -d选项使shell忘记每一个指定name的文件位置
     If the  -t option is supplied,the full  pathnameto which each name corresponds is  printed.
     使用-t选项,每一个匹配到的name的完整路径将会被输出。
     If multiple name arguments are supplied with -t ,the name is printed before the  hashed full pathname.
     如果使用-t选项后很多个name的参数,输出之前会在hashed完整的路径名之前,加上name,一起输出。
     The  -l option cause output to  be display in a  format that may be reused as  input.
     -l选项输出时按照一个格式显示,输出内容可能还可以作为输入使用。
     If no  arguments are  given,or if only -l is supplied, information  about rembered commands is printed.
     如果没有参数,或者只跟一个-l选项,被记住的命令的信息会被输出
     The return status is ture unless a name is not  found or an invalid option is supplied
     返回状态是ture,除非name没有找到,或者是一个无效的选项

当执行外部命令时,默认会从PATH路径下寻找该命令,找到后会将这条命令的路径记录到hash表缓存中,当再次使用该命令时,shell会首先查找hash表,如果存在的话,就执行,如果不存在将会去PATH中执行搜索。
命令格式
hash [-lr] [-p filename] [-dt] [name]
hash -p filename name: 将filename全路径起别名为name记录到hash中
hash命令详解用法
hash -d name 清空指定name的缓存
hash命令详解用法
hash -r 清空所有hash缓存
hash命令详解用法
hash -t name 将所有匹配到的name全部输出
hash命令详解用法
hash -t name1 name2 参数name如果是多个的话,会在对应的行开头显示名称。
hash命令详解用法
hash -l [name] 按照一个特定格式显示hash缓存,还可以作为输入使用
hash命令详解用法
hash后面没有参数 或者只有一个-l选项,hash表中的所有缓存信息将会被输出。不同之处在于显示结果的格式不同而已。
hash命令详解用法

推荐阅读:
  1. man 命令详解
  2. linux中hash命令的用法

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

hash sh命令

上一篇:hadoop+hbase+zookeeper完全分布安装(1)

下一篇:从0开始学大数据-Java基础语法(2)

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》