[ zsh ] 맥 터미널에서 내 프로젝트 파일 구조를 보고 싶다면?

2023. 8. 25. 01:49devOps

맥 터미널에서 아래 명령어를 친다. 우선 🍻 brew 가 설치되어 있어야한다.

github 통해 설치

$ git clone https://github.com/Homebrew/brew homebrew

더 자세한 설명은
brew
brew_kr

[Homebrew

The Missing Package Manager for macOS (or Linux).

brew.sh](https://brew.sh/index_ko)

tree 설치방법 ( brew 가 설치되어 있다는 가정하에..)

$ brew install tree

폴더 구조 보는 방법

$ tree

그 외 명령어 

찾았다! 너다..이거 좋구나..

1. 색 넣어서 파일 구조 구분

$ tree -C

색 들어가서 더 구분하기 좋구나~

2. 디렉토리의 목록 보기

tree -d

 

디렉토리 구조만 봤을 때, 예시

더보기
├── Movieflex
│   ├── Animations
│   ├── Assets
│   ├── Code
│   │   ├── Models
│   │   ├── Modules
│   │   │   ├── Home
│   │   │   │   ├── Base.lproj
│   │   │   │   └── Cells
│   │   │   └── Search
│   │   │       └── Cells
│   │   ├── Services
│   │   ├── Utils
│   │   ├── ViewModels
│   │   └── Views
│   ├── Effects & Layers
│   ├── Extensions
│   ├── Movieflex.xcdatamodeld
│   │   └── Movieflex.xcdatamodel
│   ├── Resources
│   │   ├── Assets.xcassets
│   │   │   ├── AppIcon.appiconset
│   │   │   ├── batman.imageset
│   │   │   └── user.imageset
│   │   ├── Base.lproj
│   │   └── Fonts
│   │       ├── Josefin Slab
│   │       ├── Raleway
│   │       └── SF-Mono
│   └── Utils
├── Movieflex.xcodeproj
│   ├── project.xcworkspace
│   │   └── xcshareddata
│   └── xcshareddata
│       └── xcschemes
├── Movieflex.xcworkspace
│   ├── xcshareddata
│   │   └── swiftpm
│   │       └── configuration
│   └── xcuserdata
│       └── a0000.xcuserdatad
├── MovieflexTests
└── Pods
    ├── Alamofire
    │   └── Source
    ├── AlamofireImage
    │   └── Source
    ├── Headers
    ├── Local Podspecs
    ├── Pods.xcodeproj
    │   └── xcuserdata
    │       └── a0000.xcuserdatad
    │           └── xcschemes
    └── Target Support Files
        ├── Alamofire
        ├── AlamofireImage
        ├── Pods-Movieflex
        └── Pods-MovieflexTests

3. 그 외 명령어 칠 때

더보기

 

>> tree --help

usage: tree [-acdfghilnpqrstuvxACDFJQNSUX] [-L level [-R]] [-H  baseHREF]
	[-T title] [-o filename] [-P pattern] [-I pattern] [--gitignore]
	[--gitfile[=]file] [--matchdirs] [--metafirst] [--ignore-case]
	[--nolinks] [--hintro[=]file] [--houtro[=]file] [--inodes] [--device]
	[--sort[=]<name>] [--dirsfirst] [--filesfirst] [--filelimit #] [--si]
	[--du] [--prune] [--charset[=]X] [--timefmt[=]format] [--fromfile]
	[--fromtabfile] [--fflinks] [--info] [--infofile[=]file] [--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.
  --gitfile X   Explicitly read gitignore file.
  --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.
  --prune       Prune empty directories from the output.
  --info        Print information about files found in .info files.
  --infofile X  Explicitly read info file.
  --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).
  --du          Compute size of directories by their contents.
  -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.
  --hintro X    Use file X as the HTML intro.
  --houtro X    Use file X as the HTML outro.
  ------- Input options -------
  --fromfile    Reads paths from files (.=stdin)
  --fromtabfile Reads trees from tab indented files (.=stdin)
  --fflinks     Process link information when using --fromfile.
  ------- Miscellaneous options -------
  --version     Print version and exit.
  --help        Print usage and this help message and exit.
  --            Options processing terminator.

Tree는 깊이 들여쓰기된 파일 목록을 생성하는 재귀 디렉터리 목록 명령이다. 이 목록은 LS_COLORS 환경 변수가 설정되고 출력이 tty인 경우 dircolors로 색상이 지정된다.

설치 지원되는 macOS 버전

Intel
Ventura ✅
Monterey ✅
Big Sur ✅
64-Bit Linux ✅

Apple Silicon
Ventura ✅
Monterey ✅
Big Sur ✅

Current versions:

stable 2.1.1