MacOSX的tree命令
2017-10-02 22:16
225 查看
Linux和Windows下的tree命令对于需要查看一个目录的文件树非常有用,但是MacOS X中居然没有(Windows中都有,居然MacOS X中没有,这怎么能忍),找到一条shell命令可以实现这个功能需求:
效果如下:
每次这样使用也不方便,当然就想到了使用
值得注意的是,需要在系统的.bashrc文件中添加该命令,这样才是全局有效并且永久生效(因为我用的是zsh,则在.zshrc文件中添加该命令)。
现在即可使用
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
相关文章推荐
- mac OS X下终端使用tree命令列目录
- mac OS X下终端使用tree命令列目录
- Mac OSX下的tree命令
- Mac OS X 命令行窗口使用 rar / unrar 命令
- Mac使用tree命令
- mac os x 命令+10个常用命令行工具
- Mac OS X:显示分辨率的命令(源程序)
- MAC OS X 终端命令入门 (简单常用整理)
- 在Mac OS X添加 ll 命令
- MAC OS X 终端命令入门 (简单常用整理)
- 40 个很有用的 Mac OS X Shell 脚本和终端命令
- 在Mac OSX上部分常用终端命令
- Mac技巧之显示/隐藏苹果的MacOSX系统下隐藏文件的终端命令
- Mac OS X 启动和终止Redis, Mac常用命令,ssh免密
- Mac OS X下终端(Terminal)常用的命令
- mac os x 下查看dd命令刻录U盘的进度
- Mac OS X 启用超级用户 sudo -s 获得系统权限 Mac终端命令
- Mac OS X Terminal command入门与命令汇总
- 在Mac OS X + Idea下搭建Maven项目 -- 安装maven及常用mvn命令介绍
- mac os x查看端口命令