溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

hash命令詳解用法

發(fā)布時(shí)間:2020-08-01 16:43:55 來源:網(wǎng)絡(luò) 閱讀:150 作者:wx5a1f8d23790cb 欄目:系統(tǒng)運(yùn)維

for each name,the full file name of command is determined by searching the directories in $PATH and remembered.
對于每一個(gè)hash命令中的參數(shù)name,命令的完整文件名被從$PATH中搜尋到的目錄的決定,然后hash命令記住這一結(jié)果。
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選項(xiàng),不執(zhí)行路徑搜索,將命令全路徑path起別名為name

     the  -r  option causes the shell  to forget  allrembered locations
     -r選項(xiàng)發(fā)使shell忘記所有已經(jīng)記住的位置
     the -d option cause the shell to forget location  of  each name
     -d選項(xiàng)使shell忘記每一個(gè)指定name的文件位置
     If the  -t option is supplied,the full  pathnameto which each name corresponds is  printed.
     使用-t選項(xiàng),每一個(gè)匹配到的name的完整路徑將會(huì)被輸出。
     If multiple name arguments are supplied with -t ,the name is printed before the  hashed full pathname.
     如果使用-t選項(xiàng)后很多個(gè)name的參數(shù),輸出之前會(huì)在hashed完整的路徑名之前,加上name,一起輸出。
     The  -l option cause output to  be display in a  format that may be reused as  input.
     -l選項(xiàng)輸出時(shí)按照一個(gè)格式顯示,輸出內(nèi)容可能還可以作為輸入使用。
     If no  arguments are  given,or if only -l is supplied, information  about rembered commands is printed.
     如果沒有參數(shù),或者只跟一個(gè)-l選項(xiàng),被記住的命令的信息會(huì)被輸出
     The return status is ture unless a name is not  found or an invalid option is supplied
     返回狀態(tài)是ture,除非name沒有找到,或者是一個(gè)無效的選項(xiàng)

當(dāng)執(zhí)行外部命令時(shí),默認(rèn)會(huì)從PATH路徑下尋找該命令,找到后會(huì)將這條命令的路徑記錄到hash表緩存中,當(dāng)再次使用該命令時(shí),shell會(huì)首先查找hash表,如果存在的話,就執(zhí)行,如果不存在將會(huì)去PATH中執(zhí)行搜索。
命令格式
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 參數(shù)name如果是多個(gè)的話,會(huì)在對應(yīng)的行開頭顯示名稱。
hash命令詳解用法
hash -l [name] 按照一個(gè)特定格式顯示hash緩存,還可以作為輸入使用
hash命令詳解用法
hash后面沒有參數(shù) 或者只有一個(gè)-l選項(xiàng),hash表中的所有緩存信息將會(huì)被輸出。不同之處在于顯示結(jié)果的格式不同而已。
hash命令詳解用法

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI