답변:
다음 pkglist과 같이 설치 될 패키지 목록을 포함하는 파일 (예 :)이있는 경우 :
pkg1
pkg2
pkg3
또는
pkg1 pkg2 pkg3
그런 apt다음 다음 명령 을 사용하여 해당 패키지를 설치할 수 있습니다 .
sudo apt-get install $(cat pkglist)xargs sudo apt-get install < pkglist자세한 내용은 apt-get install방문 man apt-get설치 섹션을 참조하십시오.
xargs sudo apt-get -y install < pkglist
xargs -a pkglist sudo apt install.
모든 패키지 이름을 파일에 넣으십시오 (각 줄에 하나의 패키지 이름). 그런 다음 아래 명령을 실행하여 주어진 패키지를 자동으로 설치하십시오.
while read -r line; do sudo apt-get -y install "$line"; done < /path/to/the/packages/file
예:
$ cat file
vlc
firefox
$ while read -r line; do sudo apt-get install "$line"; done < file
[sudo] password for avinash:
Reading package lists... Done
Building dependency tree
Reading state information... Done
vlc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 499 not upgraded.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
ttf-lyx
The following packages will be upgraded:
firefox
1 upgraded, 0 newly installed, 0 to remove and 498 not upgraded.
Need to get 35.8 MB of archives.
After this operation, 24.3 MB of additional disk space will be used.
Get:1 http://ftp.cuhk.edu.hk/pub/Linux/ubuntu/ trusty-updates/main firefox amd64 33.0+build2-0ubuntu0.14.04.1 [35.8 MB]
0% [1 firefox 67.0 kB/35.8 MB 0%] 10.4 kB/s 57min 16s^