![설치된 패키지가 있는 경우 정확한 이름으로 어떻게 찾나요?](https://linux55.com/image/188929/%EC%84%A4%EC%B9%98%EB%90%9C%20%ED%8C%A8%ED%82%A4%EC%A7%80%EA%B0%80%20%EC%9E%88%EB%8A%94%20%EA%B2%BD%EC%9A%B0%20%EC%A0%95%ED%99%95%ED%95%9C%20%EC%9D%B4%EB%A6%84%EC%9C%BC%EB%A1%9C%20%EC%96%B4%EB%96%BB%EA%B2%8C%20%EC%B0%BE%EB%82%98%EC%9A%94%3F.png)
특정 패키지가 설치되어 있는지 확인하고 싶습니다. 정확히 일치하는 항목이 필요합니다.
nginx로 시작하는 패키지를 찾을 수 있습니다.
$ dpkg -l | grep -w 'nginx'
ii nginx 1.18.0-0ubuntu1 all small, powerful, scalable web/proxy server
ii nginx-common 1.18.0-0ubuntu1 all small, powerful, scalable web/proxy server - common files
ii nginx-core 1.18.0-0ubuntu1 amd64 nginx web/proxy server (standard version)
$ dpkg -l | grep -w 'nginx$'
$ dpkg -l | grep -w "nginx"
ii nginx 1.18.0-0ubuntu1 all small, powerful, scalable web/proxy server
ii nginx-common 1.18.0-0ubuntu1 all small, powerful, scalable web/proxy server - common files
ii nginx-core 1.18.0-0ubuntu1 amd64 nginx web/proxy server (standard version)
$ dpkg -l | grep -w "\<nginx\>"
ii nginx 1.18.0-0ubuntu1 all small, powerful, scalable web/proxy server
ii nginx-common 1.18.0-0ubuntu1 all small, powerful, scalable web/proxy server - common files
ii nginx-core 1.18.0-0ubuntu1 amd64 nginx web/proxy server (standard version)
$ dpkg -l | grep "\<nginx\>"
ii nginx 1.18.0-0ubuntu1 all small, powerful, scalable web/proxy server
ii nginx-common 1.18.0-0ubuntu1 all small, powerful, scalable web/proxy server - common files
ii nginx-core 1.18.0-0ubuntu1 amd64 nginx web/proxy server (standard version)
그리고 나는 단지 nginx를 원합니다. 어떻게 고치나요?
답변1
설명된 대로패키지가 dpkg에 있지만 apt를 통해 설치할 수 없습니다., 사용 dpkg-query
:
dpkg-query -W -f '${db:Status-Status}' nginx
nginx
"설치됨"은 해당 패키지가 완전히 설치된 경우에만 나타납니다.
그래도 문제가 해결되지 않으면 dpkg-query
패키지를 매개변수로 지정하세요 dpkg -l
.
dpkg -l nginx
답변2
필터링된 출력 dpkg -l
:
dpkg -l | awk /^ii/'{print $2}' | grep -w nginx$
( )와 같은 결과 sudo apt install dctrl-tools
:
grep-status -FStatus -sPackage -n "install ok installed" |grep -w nginx$