Pacman은 Arch Linux 및 파생 배포판의 패키지 관리자로, 단순한 바이너리 패키지 형식과 사용하기 쉬운 빌드 시스템을 결합한 도구입니다.
핵심 작업
| 명령어 | 동작 |
|---|---|
sudo pacman -Syu |
데이터베이스 동기화 및 전체 시스템 업그레이드 |
sudo pacman -S <pkg> |
특정 패키지 설치 |
sudo pacman -Syu <pkg> |
저장소 업데이트 후 패키지 설치 |
sudo pacman -R <pkg> |
패키지 제거 (의존성 유지) |
sudo pacman -Rsc <pkg> |
패키지와 불필요한 의존성을 재귀적으로 제거 |
pacman -Ss <keyword> |
원격 저장소에서 키워드로 패키지 검색 |
패키지 조회 (-Q)
# List all explicitly installed packages
pacman -Qe
# List all files installed by a specific package
pacman -Ql nginx
# Search for the package that owns a specific file
pacman -Qo /usr/bin/git
# Show detailed metadata and dependencies for installed package
pacman -Qi python
# Search locally installed packages for keywords
pacman -Qs ripgrep
고아 의존성 정리
고아(Orphan) 패키지는 의존성으로 설치되었으나 현재 활성 패키지에서 더 이상 필요하지 않은 패키지를 뜻합니다:
# List orphan packages
pacman -Qdt
# Remove all orphan packages and their unused configurations
sudo pacman -Rns $(pacman -Qdtq)
# Clean cached package downloads (/var/cache/pacman/pkg/)
sudo pacman -Sc
의존성 트리 검사 (pactree)
# View dependency tree for a package
pactree ripgrep
# View reverse dependencies (what packages depend on this)
pactree -r openssl