前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >tree指令

tree指令

作者头像
JNingWei
发布2018-09-28 16:06:10
9100
发布2018-09-28 16:06:10
举报
文章被收录于专栏:JNing的专栏JNing的专栏

安装tree库

代码语言:javascript
复制
sudo apt-get install tree

查看tree的帮助文档

代码语言:javascript
复制
:~$ tree --help
usage: tree [-acdfghilnpqrstuvxACDFQNSUX] [-H baseHREF] [-T title ] [-L level [-R]]
    [-P pattern] [-I pattern] [-o filename] [--version] [--help] [--inodes]
    [--device] [--noreport] [--nolinks] [--dirsfirst] [--charset charset]
    [--filelimit[=]#] [--si] [--timefmt[=]<f>] [<directory list>]
  ------- Listing options -------
  -a            All files are listed.
  -d            List directories only.
  -l            Follow symbolic links like directories.
  -f            Print the full path prefix for each file.
  -x            Stay on current filesystem only.
  -L level      Descend only level directories deep.
  -R            Rerun tree when max dir level reached.
  -P pattern    List only those files that match the pattern given.
  -I pattern    Do not list files that match the given pattern.
  --noreport    Turn off file/directory count at end of tree listing.
  --charset X   Use charset X for terminal/HTML and indentation line output.
  --filelimit # Do not descend dirs with more than # files in them.
  --timefmt <f> Print and format time according to the format <f>.
  -o filename   Output to file instead of stdout.
  -------- File options ---------
  -q            Print non-printable characters as '?'.
  -N            Print non-printable characters as is.
  -Q            Quote filenames with double quotes.
  -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.
  --si          Like -h, but use in SI units (powers of 1000).
  -D            Print the date of last modification or (-c) status change.
  -F            Appends '/', '=', '*', '@', '|' or '>' as per ls -F.
  --inodes      Print inode number of each file.
  --device      Print device ID number to which each file belongs.
  ------- Sorting options -------
  -v            Sort files alphanumerically by version.
  -r            Sort files in reverse alphanumeric order.
  -t            Sort files by last modification time.
  -c            Sort files by last status change time.
  -U            Leave files unsorted.
  --dirsfirst   List directories before files (-U disables).
  ------- Graphics options ------
  -i            Don't print indentation lines.
  -A            Print ANSI lines graphic indentation lines.
  -S            Print with ASCII graphics indentation lines.
  -n            Turn colorization off always (-C overrides).
  -C            Turn colorization on always.
  ------- XML/HTML options -------
  -X            Prints out an XML representation of the tree.
  -H baseHREF   Prints out HTML format with baseHREF as top directory.
  -T string     Replace the default HTML title and H1 header with string.
  --nolinks     Turn off hyperlinks in HTML output.
  ---- Miscellaneous options ----
  --version     Print version and exit.
  --help        Print usage and this help message and exit.

操作举例

显示所有文件(不包括隐藏文件):

代码语言:javascript
复制
tree

  输出:

代码语言:javascript
复制
.
├── Image_Generated
│   ├── Averaging_Blur_Enhanced.jpg
│   ├── Averaging_Blur.jpg
│   ├── Completed_Blur.jpg
│   ├── Edge_Detection_360_degree.jpg
│   ├── Edge_Detection_45_degree.jpg
│   ├── Embossing_45_degree.jpg
│   ├── Embossing_Asymmetric.jpg
│   ├── Embossing_.jpg
│   ├── Gaussian_Blur.jpg
│   ├── Motion_Blur.jpg
│   ├── Naive.jpg
│   ├── Sharpness_Center.jpg
│   └── Sharpness_Edge.jpg
├── Image_Origin
│   └── Elegent_Girl.jpg
├── README.md
├── requirements.txt
└── src
    ├── convolution.py
    ├── filter.py
    ├── main.py
    └── run.sh

3 directories, 20 files

只显示文件夹:

代码语言:javascript
复制
tree -d

  输出:

代码语言:javascript
复制
.
├── Image_Generated
├── Image_Origin
└── src

3 directories

显示所有文件(包括隐藏文件):

代码语言:javascript
复制
tree -a

  输出:

代码语言:javascript
复制
.
├── .git
│   ├── branches
│   ├── COMMIT_EDITMSG
│   ├── config
│   ├── description
│   ├── FETCH_HEAD
│   ├── HEAD
│   ├── hooks
│   │   ├── applypatch-msg.sample
│   │   ├── commit-msg.sample
│   │   ├── post-update.sample
│   │   ├── pre-applypatch.sample
│   │   ├── pre-commit.sample
│   │   ├── prepare-commit-msg.sample
│   │   ├── pre-push.sample
│   │   ├── pre-rebase.sample
│   │   └── update.sample
│   ├── index
│   ├── info
│   │   └── exclude
│   ├── logs
│   │   ├── HEAD
│   │   └── refs
│   │       ├── heads
│   │       │   └── master
│   │       └── remotes
│   │           └── origin
│   │               └── master
│   ├── objects
│   │   ├── 0e
│   │   │   └── ec93e862fe54032b112ca19265fdb90609fb53
│   │   ├── 12
│   │   │   └── ffcdab3989314a79ad363e2a20671c29f3bd0c
│   │   ├── 16
│   │   │   └── 5e327e2f61cb84ace4bcd2c12a60874ec6fdc7
│   │   ├── 18
│   │   │   └── c7dcc2b44495e36d1fd9f3dfb39d96b8fcc0cf
│   │   ├── 1a
│   │   │   └── e55d35b920c90b26c27829dd55546c9a898c0a
│   │   ├── 22
│   │   │   ├── 4301ec4059d22e39736d710f5e38d0bb5e4e5e
│   │   │   └── 44f6edb803d0731d08b4ebeec5593ff5050118
│   │   ├── 23
│   │   │   └── 69dedcc32959f764e382d8b7ffe2035781f768
│   │   ├── 28
│   │   │   └── 82a713ba71f7843b5eea5aa0e7058f1afbdc23
│   │   ├── 3b
│   │   │   └── 00325224fe9769d0253eb6078d5e31c621892f
│   │   ├── 43
│   │   │   └── 642dee9c626b48d38470e1ed91fa4cf6a0361a
│   │   ├── 53
│   │   │   └── 8ec6dcb0e17c614948912061c40d7c2a2aaa73
│   │   ├── 54
│   │   │   └── b69844052ccad0a7f4829207f68020f8cbe2ff
│   │   ├── 59
│   │   │   └── 7ba6b940bbc208322052816cd209749e2967c1
│   │   ├── 5c
│   │   │   └── bb0212b2a864eff40369ade20792d13dee7aed
│   │   ├── 5f
│   │   │   └── deb71da3d17f8784a9b45eeee2c1fec99510fc
│   │   ├── 60
│   │   │   └── 85900d533af6a4d61419e71a887420c2583bd1
│   │   ├── 63
│   │   │   └── 1864dae56f33e711d1b742e4ef313d70e18371
│   │   ├── 65
│   │   │   └── 9fbad800e4d607444ded54c98638368957681e
│   │   ├── 69
│   │   │   └── da980783fa6db646bf0e3404c180b9309f7581
│   │   ├── 6d
│   │   │   └── 807e8acdcdc4e4b05596ec912691d7af9f79a4
│   │   ├── 76
│   │   │   └── a41df274117afc56715e46acf35daecb0b828b
│   │   ├── 87
│   │   │   └── 76aa55298eff4ca46c3ba2231d21e1b8cc5650
│   │   ├── 92
│   │   │   └── 83a3128ba8de5290052b2efd5b8504a4516384
│   │   ├── 93
│   │   │   └── 3a2011fd9e6f54cdd044ee74e9151758408ec9
│   │   ├── b9
│   │   │   └── 6444449dc64d52219a28aa1c9d06511349a522
│   │   ├── c7
│   │   │   └── 4772f9b1e58c8dd903dfa4a3c760bcd0fe901e
│   │   ├── cf
│   │   │   └── 7d3163f15935902f53d53a29a748660c4ed532
│   │   ├── d1
│   │   │   └── 411627491e803b66e57c1dbb2bc2228b2154ce
│   │   ├── e0
│   │   │   └── 228271b6d091a4d9a1b7dbfe4264124a531a6a
│   │   ├── ec
│   │   │   └── c399f41d63545e1a902d50cb211f91c3f045d0
│   │   ├── ee
│   │   │   ├── 077213f7bc3aa03d2025c7ecf372727530f590
│   │   │   └── 7db981a14bb8a09b87d542985a467fdda61153
│   │   ├── info
│   │   └── pack
│   ├── ORIG_HEAD
│   └── refs
│       ├── heads
│       │   └── master
│       ├── remotes
│       │   └── origin
│       │       └── master
│       └── tags
├── Image_Generated
│   ├── Averaging_Blur_Enhanced.jpg
│   ├── Averaging_Blur.jpg
│   ├── Completed_Blur.jpg
│   ├── Edge_Detection_360_degree.jpg
│   ├── Edge_Detection_45_degree.jpg
│   ├── Embossing_45_degree.jpg
│   ├── Embossing_Asymmetric.jpg
│   ├── Embossing_.jpg
│   ├── Gaussian_Blur.jpg
│   ├── Motion_Blur.jpg
│   ├── Naive.jpg
│   ├── Sharpness_Center.jpg
│   └── Sharpness_Edge.jpg
├── Image_Origin
│   └── Elegent_Girl.jpg
├── README.md
├── requirements.txt
└── src
    ├── convolution.py
    ├── filter.py
    ├── main.py
    └── run.sh

51 directories, 75 files


本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2017年07月03日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 安装tree库
  • 查看tree的帮助文档
  • 操作举例
    • 显示所有文件(不包括隐藏文件):
      • 只显示文件夹:
        • 显示所有文件(包括隐藏文件):
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档