目次

概要

ディレクトリまたはファイルをツリー構造で表示する方法。

findを使用

ディレクトリのツリー構造

書式

find [対象PATH] -type d|sort|sed -ne'1b;s/[^\/]*\//+--/g;s/+--+/|  +/g;s/+--+/|

実行例(/etc配下を表示)

#  find /etc -type d|sort|sed -ne'1b;s/[^\/]*\//+--/g;s/+--+/|   +/g;s/+--+/|  +/g;s/+--|/|  |/g;p'
|  +--ConsoleKit
|  |  +--run-seat.d
|  |  +--run-session.d
|  |  +--seats.d
|  +--NetworkManager
|  |  +--dispatcher.d
|  +--X11
<以下略>

ファイルをツリー構造で表示

書式

find [対象PATH] -type f|sort|sed -ne'1b;s/[^\/]*\//+--/g;s/+--+/|  +/g;s/+--+/|

実行例(/etc配下を表示)

#  find /etc -type f|sort|sed -ne'1b;s/[^\/]*\//+--/g;s/+--+/|   +/g;s/+--+/| 
 +/g;s/+--|/|  |/g;p'
|  |  |  +--00-primary.seat
|  +--DIR_COLORS
|  +--DIR_COLORS.256color
|  +--DIR_COLORS.lightbgcolor
|  |  |  +--00-netreport
|  |  |  +--05-netfs
|  |  |  +--10-dhclient
|  +--Trolltech.conf
<以下略>

トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2025-03-16 (日) 23:20:58