Linux/Ubuntu tree 命令以树形结构显示文件夹目录结构
2016-07-18 16:18
981 查看
1、安装命令工具
2、可以查看关于tree命令的帮助信息
3、使用方法(常用)
(1) 显示当前目录的树形结构
(2) 只查看当前第一级的目录和文件
(3) 只查看当前第二级的目录和文件
(4) 只查看当前第N级的目录和文件
(5) 把目录结构信息保存到文本中
sudo apt-get -y install tree
2、可以查看关于tree命令的帮助信息
$ tree --help usage: tree [-adfghilnpqrstuvxACDFNS] [-H baseHREF] [-T title ] [-L level [-R]] [-P pattern] [-I pattern] [-o filename] [--version] [--help] [--inodes] [--device] [--noreport] [--nolinks] [--dirsfirst] [--charset charset] [--filelimit #] [<directory list>] -a All files are listed. -d List directories only. -l Follow symbolic links like directories. -f Print the full path prefix for each file. -i Don't print indentation lines. -q Print non-printable characters as '?'. -N Print non-printable characters as is. -p Print the protections for each file. -u Displays file owner or UID number. -g Displays file group owner or GID number. -s Print the size in bytes of each file. -h Print the size in a more human readable way. -D Print the date of last modification. -F Appends '/', '=', '*', or '|' as per ls -F. -v Sort files alphanumerically by version. -r Sort files in reverse alphanumeric order. -t Sort files by last modification time. -x Stay on current filesystem only. -L level Descend only level directories deep.
3、使用方法(常用)
(1) 显示当前目录的树形结构
jianbao@jianbao-pc:/www/软件开发$ tree . ├── PPT │ └── PHP性能监控与优化.pptx ├── 电子书 │ ├── Linux.环境C程序设计.徐诚.扫描版.pdf │ └── UNIX环境高级编程(中文第三版)_扫描版.pdf ├── 视频 │ └── PHP_C扩展 │ ├── PHP扩展开发教程.mp4 │ ├── swoole第三节第4部分.mp4 │ ├── swoole视频教程第3节 swoole服务器的进程_线程模型.mp4 │ └── 其他 │ ├── swoole-chat第二节第二部分.mp4 │ ├── swoole-chat第二节第三部分.mp4 └── 手册 └── php_enhanced_zh.chm
(2) 只查看当前第一级的目录和文件
$ tree -L 1
(3) 只查看当前第二级的目录和文件
$ tree -L 2
(4) 只查看当前第N级的目录和文件
$ tree -L N
(5) 把目录结构信息保存到文本中
$ tree -L 2 > /home/php-note.com/tree.txt
相关文章推荐
- CentOS7下安装PHP7
- 每天一个linux命令(53)--ps命令
- 常用Linux命令
- ubuntu16.04 SVN的安装与使用
- linux命令-2
- linux系统的指令基础2
- linux下sersync同步软件的安装及配置
- 用rsync从Linux到Windows远程备份
- LINUX下Db2安装
- CentOS 下PHP5.3升级到PHP5.4步骤
- RedHat Linux RHEL6配置本地YUM源
- Linux循环设备/dev/loop解析
- 【精】Linux 使用free查询可用内存
- 【linux】VMware12.0安装
- windows/linux 查看端口进程号
- linux常用有效定位及处理命令汇总
- Linux进程管理(二、 进程创建)
- Centos7设置静态IP
- linux 编译 安装 thrift
- linux文件类型有哪些