티스토리 뷰
프로젝트 폴더 구조가 복잡하거나 많을 때 캡처을 쓸 수 있지만,
간단하게 구조를 보여주는 tree 명령어를 사용하면 보다 직관적이고 간편하게 알아볼 수 있다.
맥(Mac)이나 리눅스(Linux) 환경에서는 터미널에 tree 명령어를 바로 입력하면 사용할 수 있다.
그러나, 윈도우에서 설치한 git bash는 tree가 내장되어 있지 않다.
Window git bash에서 tree 사용하기
1. tree.exe 다운로드
http://gnuwin32.sourceforge.net/packages/tree.htm
위 링크에서 Binaries Zip 압축 파일을 다운로드 받는다.
2. C:\Program Files\Git\usr\bin 경로에서 위 압축파일 안에 있는 tree.exe을 실행한다.
# 경로 이동
$ cd C:\Program Files\Git\usr\bin
# 파일 탐색기 창 켜기
$ start .
tree 명령어 옵션 모음
▼ --help 명령어로 나온 공식 도움말 원문
usage: tree [-acdfghilnpqrstuvxACDFJQNSUX] [-L level [-R]] [-H baseHREF]
[-T title] [-o filename] [-P pattern] [-I pattern] [--gitignore]
[--matchdirs] [--metafirst] [--ignore-case] [--nolinks] [--inodes]
[--device] [--sort[=]<name>] [--dirsfirst] [--filesfirst]
[--filelimit #] [--si] [--du] [--prune] [--charset X]
[--timefmt[=]format] [--fromfile] [--noreport] [--version] [--help]
[--] [directory ...]
------- 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.
--gitignore Filter by using .gitignore files.
--ignore-case Ignore case when pattern matching.
--matchdirs Include directory names in -P pattern matching.
--metafirst Print meta-data at the beginning of each line.
--info Print information about files found in .info files.
--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.
-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.
--timefmt <f> Print and format time according to the format <f>.
-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.
-t Sort files by last modification time.
-c Sort files by last status change time.
-U Leave files unsorted.
-r Reverse the order of the sort.
--dirsfirst List directories before files (-U disables).
--filesfirst List files before directories (-U disables).
--sort X Select sort: name,version,size,mtime,ctime.
------- Graphics options -------
-i Don't print indentation lines.
-A Print ANSI lines graphic indentation lines.
-S Print with CP437 (console) graphics indentation lines.
-n Turn colorization off always (-C overrides).
-C Turn colorization on always.
------- XML/HTML/JSON options -------
-X Prints out an XML representation of the tree.
-J Prints out an JSON 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.
------- Input options -------
--fromfile Reads paths from files (.=stdin)
------- Miscellaneous options -------
--version Print version and exit.
--help Print usage and this help message and exit.
-- Options processing terminator.
기본 명령어
tree
-d 옵션 : 오직 폴더만 나타남
tree -d
- C 옵션 : 색상이 추가됨
tree -C
-I 옵션 : 특정 패턴에 맞는 폴더를 제외
tree -I node_modules
# 여러 디렉토리 한 번에 제외
tree -I 'node_modules|cache'
-L 옵션 : 디렉토리 깊이 수준(단계)을 지정
tree -d -L 2 # 현재 위치에서 2단계 하위까지 디렉토리만 출력
참고자료
https://superuser.com/questions/531592/how-to-add-the-tree-command-to-git-bash-in-windows
https://dev.to/flyingduck92/add-tree-to-git-bash-on-windows-10-1eb1
'Etc' 카테고리의 다른 글
[보안/HTTPS] letsencrypt certbot SSL 인증서 잃어버렸을 때 재발급 및 폐기 (0) | 2023.06.13 |
---|---|
[Chrome] 크롬 자동 업데이트 비활성화하는 방법 (0) | 2022.07.13 |
[Error] listen EADDRINUSE: address already in use 윈도우 해결 (0) | 2022.05.21 |