3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

treeコマンド

Posted at

お題

historyコマンドに続き、気が向いたのでtreeコマンドについても少し戯れてみる。

実践

$ tree
.
├── README.md
└── src
    ├── main
    │   ├── chap01
    │   │   └── Main.java
    │   ├── chap02
    │   │   ├── Main.java
    │   │   └── foo.txt
    │   └── stream
    │       ├── Main.java
    │       ├── PgLang.java
    │       ├── PgLangFactory.java
    │       └── S.java
    └── test

■「.」ファイルも含めて表示

$ tree -a
.
├── .git
│   ├── COMMIT_EDITMSG
│   ├── FETCH_HEAD
│   ├── HEAD
│   │  〜省略〜
│   ├── objects
│   │   ├── 07
│   │   │   └── 15ce3de7c9837b35bccdb3f2f4dffdae1d9318
│   │   │     〜省略〜
│   │   ├── info
│   │   └── pack
│   │       ├── pack-a59346cd0f4da08405f4337d80b81d90b0e4559b.idx
│   │       └── pack-a59346cd0f4da08405f4337d80b81d90b0e4559b.pack
│   ├── packed-refs
│   └── refs
│       ├── heads
│       |  〜省略〜
│       └── tags
├── .gitignore
├── README.md
└── src
    ├── main
    │   ├── chap01
    │   │   └── Main.java
    │   ├── chap02
    │   │   ├── Main.java
    │   │   └── foo.txt
    │   └── stream
    │       ├── Main.java
    │       ├── PgLang.java
    │       ├── PgLangFactory.java
    │       └── S.java
    └── test

■ディレクトリだけ表示

$ tree -d
.
└── src
    ├── main
    │   ├── chap01
    │   ├── chap02
    │   └── stream
    └── test

■各ファイルのパスごと表示

$ tree -f
.
├── ./README.md
└── ./src
    ├── ./src/main
    │   ├── ./src/main/chap01
    │   │   └── ./src/main/chap01/Main.java
    │   ├── ./src/main/chap02
    │   │   ├── ./src/main/chap02/Main.java
    │   │   └── ./src/main/chap02/foo.txt
    │   └── ./src/main/stream
    │       ├── ./src/main/stream/Main.java
    │       ├── ./src/main/stream/PgLang.java
    │       ├── ./src/main/stream/PgLangFactory.java
    │       └── ./src/main/stream/S.java
    └── ./src/test

■表示階層を絞る

$ tree -L 2
.
├── README.md
└── src
    ├── main
    └── test

■フィルタして表示

$ tree -P M*
.
└── src
    ├── main
    │   ├── chap01
    │   │   └── Main.java
    │   ├── chap02
    │   │   └── Main.java
    │   └── stream
    │       └── Main.java
    └── test
3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?