Đặt tất cả các tên gói vào một tệp (một tên gói cho mỗi dòng). Và sau đó chạy lệnh dưới đây để cài đặt các gói đã cho tự động.
while read -r line; do sudo apt-get -y install "$line"; done < /path/to/the/packages/file
Thí dụ:
$ 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^