디렉토리 레이아웃
디렉터리 구조 개요
/
├── bin → Essential user commands
├── boot → Boot files
├── dev → Device files
├── etc → System configuration
├── home → User home directories
├── lib → System library files
├── media → Auto-mount points
├── mnt → Manual mount points
├── opt → Third-party software
├── proc → Process information (virtual)
├── root → Root user home directory
├── run → Runtime data
├── sbin → System administration commands
├── srv → Service data
├── sys → Kernel device information (virtual)
├── tmp → Temporary files
├── usr → User-level programs and data
└── var → Variable data자세한 설명
/etc — 시스템 구성 파일
거의 모든 시스템 서비스에 대한 구성 파일을 저장합니다.
/etc/
├── apt/ # APT package manager configuration
│ └── sources.list.d/ # Software source configuration
├── default/grub # GRUB bootloader configuration
├── fstab # Disk mount configuration
├── hostname # Hostname
├── hosts # Local DNS mapping
├── NetworkManager/ # Network management configuration
├── nginx/ # Nginx configuration (if installed)
├── passwd # User account information
├── shadow # User passwords (encrypted)
├── ssh/ # SSH server configuration
├── sudoers # sudo permissions configuration
├── systemd/ # systemd configuration overrides
└── environment # Global environment variables/var — 변수 데이터
런타임 중에 변경되는 데이터를 저장합니다.
/var/
├── cache/apt/archives/ # APT download cache
├── lib/ # Program runtime data
│ ├── dpkg/ # dpkg package database
│ └── snapd/ # Snap data
├── log/ # System logs
│ ├── syslog # System log
│ ├── auth.log # Authentication log
│ └── kern.log # Kernel log
├── mail/ # Mail
├── spool/cron/ # Cron jobs
└── www/html/ # Default web directory/home — 사용자 홈 디렉터리
각 일반 사용자에게는 /home/username 디렉터리가 있습니다.
/home/user/
├── .bashrc # Bash configuration
├── .config/ # User-level application configuration (XDG)
├── .local/ # User-level data and programs
│ ├── bin/ # User-level executables
│ └── share/ # User-level data
├── .ssh/ # SSH keys and configuration
├── Desktop/ # Desktop
├── Documents/ # Documents
├── Downloads/ # Downloads
└── snap/ # Snap user data/usr — 사용자 수준 프로그램
시스템에 의해 설치된 프로그램 및 라이브러리 파일. 읽기 전용 디렉터리입니다.
/usr/
├── bin/ # User commands (ls, cp, vim, etc.)
├── sbin/ # System administration commands
├── lib/ # Library files
├── lib64/ # 64-bit library files
├── include/ # C/C++ header files
├── share/ # Architecture-independent data
│ ├── applications/ # .desktop files
│ ├── doc/ # Documentation
│ ├── fonts/ # Fonts
│ └── man/ # Man pages
└── local/ # Locally compiled programs
├── bin/
├── lib/
└── share//opt — 타사 소프트웨어
독립적으로 설치된 타사 상용 또는 대규모 소프트웨어 패키지.
/opt/
├── google/chrome/ # Google Chrome
├── visual-studio-code/ # VS Code (when not installed as Snap)
└── .../tmp — 임시 파일
모든 사용자가 읽고 쓸 수 있습니다. 일반적으로 시스템 재부팅 시 지워집니다.
# Check /tmp usage
du -sh /tmp
# Permissions: drwxrwxrwt (sticky bit)
# Anyone can write, but only the owner can delete their own files/boot — 부팅 파일
/boot/
├── vmlinuz-* # Linux kernel
├── initrd.img-* # Initial RAM disk
├── config-* # Kernel configuration
├── grub/ # GRUB bootloader
│ └── grub.cfg # GRUB configuration (auto-generated)
└── efi/ # EFI partition mount point
└── EFI/
├── ubuntu/ # Ubuntu boot files
└── BOOT/ # Default boot files/dev — 장치 파일
/dev/
├── sda, sdb... # SATA/SCSI hard drives
├── nvme0n1 # NVMe hard drive
├── tty* # Terminal devices
├── video0 # Webcam
├── null # Null device (discards output)
├── zero # Zero device (produces zero bytes)
├── random, urandom # Random number generators
└── loop* # Loop devices (used by Snap)/proc 및 /sys — 가상 파일 시스템
이는 실제 디스크 파일이 아니라 커널에 의해 노출된 인터페이스입니다.
# Common /proc files
cat /proc/cpuinfo # CPU information
cat /proc/meminfo # Memory information
cat /proc/version # Kernel version
cat /proc/partitions # Partition information
# Common /sys files
cat /sys/class/power_supply/BAT0/capacity # Battery level
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor # CPU frequency governor/run — 런타임 데이터
시스템 부팅 후 생성된 임시 런타임 데이터입니다. 재부팅시 지워집니다.
/run/
├── user/1000/ # Current user runtime data
├── snapd/ # Snap runtime
├── lock/ # Lock files
└── systemd/ # systemd runtime빠른 조회
# Find the path of a command
which command-name
type command-name
# Find which package owns a file
dpkg -S /path/to/file
# List files installed by a package
dpkg -L package-name