본문 바로가기

리눅스

apt/apt-get command

728x90

apt/apt-get command

 APT(Advanced Packaging Tool)는 데비안(Debian) GNU/리눅스 계열의 패키지 관리 명령도구로 우분투(Ubuntu)에서도 지원한다.

apt와 apt-get의 차이점

apt: 더 나은 대화식 사용을위한 고급 명령 줄 인터페이스이다.

apt-get: 인증 된 소스에서 패키지 및 패키지에 대한 정보를 검색하고 종속성과 함께 패키지를 설치, 업그레이드 및 제거한다.

 

apt command apt-get command
명령의 기능
apt install apt-get install 패키지를 설치합니다
apt remove apt-get remove 패키지를 제거합니다
apt purge apt-get purge 패키지와 해당 구성 파일을 제거합니다
apt update apt-get update 리포지토리 정보 업데이트
apt upgrade apt-get upgrade 업그레이드 가능한 모든 패키지 업그레이드
apt autoremove apt-get autoremove 더 이상 필요하지 않은 라이브러리 및 기타 패키지 제거
apt full-upgrade apt-get dist-upgrade
종속성 자동 처리로 패키지 업그레이드
apt search apt-cache search 저장소에서 패키지 이름을 검색
apt show apt-cache show 패키지에 대한 정보를 표시
apt list   설치되었거나 업그레이드 가능한 패키지 목록을 표시합니다
apt edit-sources   apt가 패키지를 검색하는 리포지토리 목록을 직접 편집합니다

 

패키지 이름을 기준으로 패키지 나열(설치된 모든 패키지만 나열)

apt list --installed | head
$ apt list --installed | head

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Listing...
acpid/jammy,now 1:2.0.33-1ubuntu1 amd64 [installed]
adduser/jammy,now 3.118ubuntu5 all [installed,automatic]
amazon-ssm-agent/now 3.1.1927.0-1 amd64 [installed,local]
amd64-microcode/jammy,now 3.20191218.1ubuntu2 amd64 [installed]
apparmor/jammy-updates,now 3.0.4-2ubuntu2.1 amd64 [installed,automatic]
apport-symptoms/jammy,now 0.24 all [installed,automatic]
apport/jammy-updates,jammy-security,now 2.20.11-0ubuntu82.1 all [installed,automatic]
apt-transport-https/jammy-updates,now 2.4.8 all [installed]
apt-utils/jammy-updates,now 2.4.8 amd64 [installed,automatic]
dpkg --get-selections | head
$ dpkg --get-selections | head
acpid						install
adduser						install
amazon-ssm-agent				install
amd64-microcode					install
apparmor					install
apport						install
apport-symptoms					install
apt						install
apt-transport-https				install
apt-utils					install
728x90
dpkg -l | head
$ dpkg -l | head
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name              Version              Architecture Description
+++-=================-====================-============-==========================================================
ii  acpid             1:2.0.33-1ubuntu1    amd64  Advanced Configuration and Power Interface event daemon
ii  adduser           3.118ubuntu5         all    add and remove users and groups
ii  amazon-ssm-agent  3.1.1927.0-1         amd64  Amazon SSM Agent for managing EC2 Instances using the SSM APIs.
ii  amd64-microcode   3.20191218.1ubuntu2  amd64  Processor microcode firmware for AMD CPUs
ii  apparmor          3.0.4-2ubuntu2.1     amd64  user-space parser utility for AppArmor
dpkg-query -l | hea
$ dpkg-query -l | hea
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name              Version              Architecture Description
+++-=================-====================-============-==========================================================
ii  acpid             1:2.0.33-1ubuntu1    amd64  Advanced Configuration and Power Interface event daemon
ii  adduser           3.118ubuntu5         all    add and remove users and groups
ii  amazon-ssm-agent  3.1.1927.0-1         amd64  Amazon SSM Agent for managing EC2 Instances using the SSM APIs.
ii  amd64-microcode   3.20191218.1ubuntu2  amd64  Processor microcode firmware for AMD CPUs
ii  apparmor          3.0.4-2ubuntu2.1     amd64  user-space parser utility for AppArmor

업그레이드 가능한 목록

apt list --upgradable
$ apt list --upgradable
Listing... Done
libnetplan0/jammy-updates 0.105-0ubuntu2~22.04.1 amd64 [upgradable from: 0.104-0ubuntu2.1]
netplan.io/jammy-updates 0.105-0ubuntu2~22.04.1 amd64 [upgradable from: 0.104-0ubuntu2.1]

사용 가능한 모든 목록

apt list --all-versions | head
$ apt list --all-versions | head

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Listing...
0ad-data-common/jammy 0.0.25b-1 all

0ad-data/jammy 0.0.25b-1 all

0ad/jammy 0.0.25b-2 amd64

0install-core/jammy 2.16-2 amd64

0install/jammy 2.16-2 amd64

apt 사용법

$ apt list --help
apt 2.4.8 (amd64)
Usage: apt [options] command

apt is a commandline package manager and provides commands for
searching and managing as well as querying information about packages.
It provides the same functionality as the specialized APT tools,
like apt-get and apt-cache, but enables options more suitable for
interactive use by default.

Most used commands:
  list - list packages based on package names
  search - search in package descriptions
  show - show package details
  install - install packages
  reinstall - reinstall packages
  remove - remove packages
  autoremove - Remove automatically all unused packages
  update - update list of available packages
  upgrade - upgrade the system by installing/upgrading packages
  full-upgrade - upgrade the system by removing/installing/upgrading packages
  edit-sources - edit the source information file
  satisfy - satisfy dependency strings

See apt(8) for more information about the available commands.
Configuration options and syntax is detailed in apt.conf(5).
Information about how to configure sources can be found in sources.list(5).
Package and version choices can be expressed via apt_preferences(5).
Security details are available in apt-secure(8).
                                        This APT has Super Cow Powers.

 

참고URL

- apt와 apt-get의 차이점 : https://itsfoss.com/apt-vs-apt-get-difference/

- howtogeek : https://www.howtogeek.com/791055/apt-vs.-apt-get-whats-the-difference-on-linux/

 

728x90