提供bash cd历史目录堆栈的程序
cdhist的Python项目详细描述
bash shell cd历史记录
cdhist是一个
提供bash shell cd history目录堆栈。bash cd
别名
调用一个python助手脚本来拦截您的普通shellcd
命令
并维护您以前访问过的一堆目录,这些目录可以是
并迅速跳转到数字索引。
最新版本和文档可在 http://github.com/bulletmark/cdhist。
使用量
将“somepath”添加到您的目录堆栈中,并在其中放入cd:
cd somepath
列出当前堆栈及其索引:
cd -l
将dir更改为堆栈索引“n”:
cd -n
在堆栈中搜索“string”和CD:
cd -/string
列出堆栈及其索引,然后立即提示dir to 选择:
cd --
您也可以在上面的提示下键入/string
进行搜索。
显示此帮助:
cd -h|?
所有其他参数都传递给普通cd命令。
安装
arch用户可以安装cdhist from the AUR并跳到下一个 区域
需要安装python-setuptools
。
需要bash+python 2.6或更高版本(并且与python 3+兼容)。
注意cdhist is on PyPI以便您可以
sudo pip install cdhist
或:
git clone http://github.com/bulletmark/cdhist
cd cdhist
sudo make uninstall # Do this to make sure old versions are purged
sudo make install
配置
每个想要使用cdhist工具的用户都应该
/etc/cdhist.bashrc
文件到它们的bashrc中,即在~/.bashrc
只需添加:
if [ -f /etc/cdhist.bashrc]; then
source /etc/cdhist.bashrc
fi
然后注销并重新登录。
替代命令名
有些人可能不希望将其系统cd
命令别名为
实用程序,只需使用另一个唯一的命令名。要做到这一点,set
CDHISTCOMMAND
调用
cdhist.bashrc
脚本。例如,使用命令名
xd
而不是cd
:
if [ -f /etc/cdhist.bashrc]; then
export CDHISTCOMMAND=xd
source /etc/cdhist.bashrc
fi
然后键入xd /tmp
更改目录,xd --
查看并选择目录,
等
升级
cd cdhist # Source dir, as above
git pull
sudo make install
移除
cd cdhist # Source dir, as above
sudo make uninstall
许可证
版权所有(c)2010、2012 Mark Blakeney。这个程序在 GNU通用公共许可条款。 这个程序是免费软件:你可以重新发布和/或修改它 根据 自由软件基金会,许可证的第3版,或任何更高版本 版本。 这个程序的发布是希望它会有用,但是 没有任何保证;甚至没有 适销性或适合某一特定目的的适销性。见GNU将军 有关详细信息,请访问http://www.gnu.org/licenses/上的公共许可证。