MacOSX的tree命令
来源:互联网 发布:中兴网络机顶盒说明书 编辑:程序博客网 时间:2024/04/28 15:09
Linux和Windows下的tree命令对于需要查看一个目录的文件树非常有用,但是MacOS X中居然没有(Windows中都有,居然MacOS X中没有,这怎么能忍),找到一条shell命令可以实现这个功能需求:
find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
效果如下:
➜ ScrapyProject git:(master) ✗ find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'.|____.DS_Store|____.git| |____branches| |____config| |____description| |____HEAD| |____hooks| | |____applypatch-msg.sample| | |____commit-msg.sample| | |____post-update.sample| | |____pre-applypatch.sample| | |____pre-commit.sample| | |____pre-push.sample| | |____pre-rebase.sample| | |____pre-receive.sample| | |____prepare-commit-msg.sample| | |____update.sample| |____info| | |____exclude| |____objects| | |____info| | |____pack| |____refs| | |____heads| | |____tags|____scrapy.cfg|____ScrapyProject| |______init__.py| |______init__.pyc| |____items.py| |____middlewares.py| |____pipelines.py| |____settings.py| |____settings.pyc| |____spiders| | |______init__.py| | |______init__.pyc| | |____DmozSpider.py
每次这样使用也不方便,当然就想到了使用alias
给命令设置别名:
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
值得注意的是,需要在系统的.bashrc文件中添加该命令,这样才是全局有效并且永久生效(因为我用的是zsh,则在.zshrc文件中添加该命令)。
现在即可使用tree
命令查看当前目录下的文件树结构了:
➜ ScrapyProject git:(master) ✗ tree.|____.DS_Store|____.git| |____branches| |____config| |____description| |____HEAD| |____hooks| | |____applypatch-msg.sample| | |____commit-msg.sample| | |____post-update.sample| | |____pre-applypatch.sample| | |____pre-commit.sample| | |____pre-push.sample| | |____pre-rebase.sample| | |____pre-receive.sample| | |____prepare-commit-msg.sample| | |____update.sample| |____info| | |____exclude| |____objects| | |____info| | |____pack| |____refs| | |____heads| | |____tags|____scrapy.cfg|____ScrapyProject| |______init__.py| |______init__.pyc| |____items.py| |____middlewares.py| |____pipelines.py| |____settings.py| |____settings.pyc| |____spiders| | |______init__.py| | |______init__.pyc| | |____DmozSpider.py
阅读全文
0 0
- MacOSX的tree命令
- MACOSX 网络诊断命令
- Mac技巧之显示/隐藏苹果的MacOSX系统下隐藏文件的终端命令
- Mac技巧之显示/隐藏苹果MacOSX系统下隐藏文件的终端命令
- [MacOSX]_[初级]_[分析文件的实用命令][定期更新]
- Mac技巧之显示/隐藏苹果MacOSX系统下隐藏文件的终端命令
- MacOSX更新本机DNS缓存命令
- 设计MacosX的Fuzzer(1)
- macosx 下oracle10g的下载
- tree命令的使用
- tree命令的模拟
- MacOSX Leopard 下GUI环境变量的设置
- MacOSX下网页Widget的做法
- MacOSX配置基于Makefile的工程
- MacOSX下一个崩溃案例的分析
- MacOSX编译coreutils出错的修改
- MacOSX编译coreutils出错的修改
- MacOSX和Windows 8的完美融合
- STM32 DMA正常模式等待传输完成和开始下一次传输
- 堆和栈区别
- Android中ADB基本使用
- 函数的重载和继承
- UVALive 7147 -智商题
- MacOSX的tree命令
- 宅男出遊裝備,沒想到也這麼“黑科技”
- 第一个只出现一次的字符java实现
- ubuntu 下U盘被锁住,不能复制粘贴文件-------解决
- CSDN-markdown编辑器[备用]
- 浅谈微服务
- Codeforces 863E
- Codeforces Round #437 Div. 2 E. Buy Low Sell High
- java发送邮件