반응형
■ tree 명령어
리눅스에서 ls 명령어를 이용하면, 특정 위치에 존재하는 디렉토리와 파일들을 확인 할 수 있습니다. 작업을 진행하다보면 디렉토리 및 파일을 좀 더 구조적으로 표현하고 싶은 경우가 있는데, tree 명령어를 활용하면 디렉터리 및 파일을 tree 형식으로 출력하여 줍니다.
사용 OS : Ubuntu 16.04 LTS
■ 설치
tree 명령어는 기본적으로 존재하는 명령어가 아니므로 apt나 yum을 이용하여 설치하여 줍니다.
sudo apt-get install tree
■ 주요 옵션
option | param | 의미 |
-d | List directories only. (디렉토리만 표시) | |
-f | Prints the full path prefix for each file. (디렉토리 경로 표시) | |
-i | Makes tree not print the indentation lines, useful when used in conjunction with the -f option. | |
-I | pattern | Do not list those files that match the wild-card pattern. |
-L | level | |
-p | pattern | List only those files that match the wild-card pattern. (파일 권한 표시) |
■ 사용법(예)
tree [옵션]
▷ 2 depth 만 표시
tree -L 2
▷ 2 depth, 파일 권한 표시
tree -L 2 -p
▷ 2 depth 와 directory만 표시
tree -L 2 -d
▷ 2 depth 와 directory only, no indention(들여쓰기제외), full path
tree -L 2 -d -fi
▷ 2 depth, 특정 directory 제외
tree -L 2 -d -I "wordpress"
반응형
'Linux 일반' 카테고리의 다른 글
[Linux]리눅스 파이프(pipe) 명령어 (0) | 2019.01.18 |
---|---|
[Ubuntu]gcc, g++ 다른 버전 추가 및 패키지 관리 (0) | 2018.12.18 |
[리눅스]원격으로 GUI 사용하기 - X11 Forwarding (0) | 2018.11.26 |
[Ubuntu]runlevel 제어 (0) | 2018.11.15 |
[Ubuntu]NVMe M.2 ssd 사용하기 (1) | 2018.11.13 |