find . -type d -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
또하나...
http://www.centerkey.com/tree/
#!/bin/sh ####################################################### # UNIX TREE # # Version: 2.3 # # File: ~/apps/tree/tree.sh # # # # Displays Structure of Directory Hierarchy # # ------------------------------------------------- # # This tiny script uses "ls", "grep", and "sed" # # in a single command to show the nesting of # # sub-directories. The setup command for PATH # # works with the Bash shell (the Mac OS X default). # # # # Setup: # # $ cd ~/apps/tree # # $ chmod u+x tree.sh # # $ ln -s ~/apps/tree/tree.sh ~/bin/tree # # $ echo "PATH=~/bin:\${PATH}" >> ~/.profile # # # # Usage: # # $ tree [directory] # # # # Examples: # # $ tree # # $ tree /etc/opt # # $ tree .. # # # # Public Domain Software -- Free to Use as You Like # # http://www.centerkey.com/tree - By Dem Pilafian # ####################################################### echo if [ "$1" != "" ] #if parameter exists, use as base folder then cd "$1" fi pwd ls -R | grep ":$" | \ sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' # 1st sed: remove colons # 2nd sed: replace higher level folder names with dashes # 3rd sed: indent graph three spaces # 4th sed: replace first dash with a vertical bar if [ `ls -F -1 | grep "/" | wc -l` = 0 ] # check if no folders then echo " -> no sub-directories" fi echo exit
'OS > LINUX' 카테고리의 다른 글
[펌] vi 사용시 ^M 없애기 (0) | 2013.07.17 |
---|---|
[펌] 일정 시간동안 접근이 없는 파일 삭제하기 [ok] (0) | 2009.08.04 |
[펌] Portsentry 설정방법 (0) | 2009.08.03 |
아파치 웹서버에서 디렉토리 보안 걸때, 주의 사항. (0) | 2009.07.17 |
Xming으로 Windows에서 Xwindow를 원격접속하기 (0) | 2009.03.25 |