
除了別名和連結之外,Linux 中還有一個簡單的方法來標記常用目錄並從終端導航到常用目錄。
為了清楚我看到的替代方法的缺點,以及為什麼我想要一個像系統這樣的書籤/收藏夾:
alias
缺點:
太具體(每個新的收藏夾都需要一個新的alias
......儘管理論上您可以建立一個別名,echo
將您的目錄附加為new alias
,這有點聰明)。無法在資料夾中嵌套收藏夾(除了繁重的配置腳本之外,無法想出一個簡單的解決方案)。
links
缺點:
雜亂的目錄讓人ls
頭痛。
pushd
/popd
缺點:
非永久性(沒有 shell 設定檔腳本)、無法在目錄中嵌套收藏夾等。
當然,我有多種想法來製作自己的非標準解決方案,但在我這樣做之前,我想了解現有的方法,如果沒有,推薦的方法是什麼。
有誰知道這樣一個類似收藏夾/書籤的終端解決方案?
答案1
只是添加我的 2 美分。
Usage:
qwe name : Traverse to directory tagged name
qwe -h : Help
qwe -l : List of saved tag
qwe -a name : Add a tag called name with the current folder"
qwe -d name : Remove a tag called name
qwe -p name : Print the directory tagged with name
要安裝,只需將腳本儲存在某處並將其來源到您的.bashrc
檔案中。
答案2
cdargs 是為目錄添加書籤的最佳工具:http://www.youtube.com/watch?v=uWB2FIQlzZg
答案3
還有巴什馬克專案(對於 bash shell),它使用單字母命令來管理目錄書籤:
s <bookmark_name> - Saves the current directory as "bookmark_name"
g <bookmark_name> - Goes (cd) to the directory associated with "bookmark_name"
p <bookmark_name> - Prints the directory associated with "bookmark_name"
d <bookmark_name> - Deletes the bookmark
l - Lists all available bookmarks
答案4
阿帕里克斯是 bash 和 zsh 書籤的純命令列實作(即非選單驅動)。可以跳到書籤的子目錄並在這些子目錄上進行製表符補全。這就是它最有魅力的地方。