apt install [duplicate]












2
















This question already has an answer here:




  • Install list of packages using apt-get

    3 answers




This looks good:



for i in package1 package2 package3; do
sudo apt-get install -y $i
done


but with the packages listed in a file:



package1
package2
..


each on its own line. Looking for simplest script to read, performance not really an issue. Of course, the odd package will require some human intervention during install to agree or for configuration.



As an aside, what's the "real" way of dealing with large lists of packages to be installed? I'm just looking for monkey-see-monkey-do.










share|improve this question















marked as duplicate by dessert, Community Jan 2 at 18:21


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • I don't really understand your question, you could read from the file and run the apt command on each read line!

    – George Udosen
    Jan 2 at 13:33











  • LOL, yes, exactly. How? (I'll google that, also, of course.)

    – Thufir
    Jan 2 at 13:35
















2
















This question already has an answer here:




  • Install list of packages using apt-get

    3 answers




This looks good:



for i in package1 package2 package3; do
sudo apt-get install -y $i
done


but with the packages listed in a file:



package1
package2
..


each on its own line. Looking for simplest script to read, performance not really an issue. Of course, the odd package will require some human intervention during install to agree or for configuration.



As an aside, what's the "real" way of dealing with large lists of packages to be installed? I'm just looking for monkey-see-monkey-do.










share|improve this question















marked as duplicate by dessert, Community Jan 2 at 18:21


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • I don't really understand your question, you could read from the file and run the apt command on each read line!

    – George Udosen
    Jan 2 at 13:33











  • LOL, yes, exactly. How? (I'll google that, also, of course.)

    – Thufir
    Jan 2 at 13:35














2












2








2









This question already has an answer here:




  • Install list of packages using apt-get

    3 answers




This looks good:



for i in package1 package2 package3; do
sudo apt-get install -y $i
done


but with the packages listed in a file:



package1
package2
..


each on its own line. Looking for simplest script to read, performance not really an issue. Of course, the odd package will require some human intervention during install to agree or for configuration.



As an aside, what's the "real" way of dealing with large lists of packages to be installed? I'm just looking for monkey-see-monkey-do.










share|improve this question

















This question already has an answer here:




  • Install list of packages using apt-get

    3 answers




This looks good:



for i in package1 package2 package3; do
sudo apt-get install -y $i
done


but with the packages listed in a file:



package1
package2
..


each on its own line. Looking for simplest script to read, performance not really an issue. Of course, the odd package will require some human intervention during install to agree or for configuration.



As an aside, what's the "real" way of dealing with large lists of packages to be installed? I'm just looking for monkey-see-monkey-do.





This question already has an answer here:




  • Install list of packages using apt-get

    3 answers








apt bash package-management software-installation automation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 2 at 13:46







Thufir

















asked Jan 2 at 13:24









ThufirThufir

1,6551044103




1,6551044103




marked as duplicate by dessert, Community Jan 2 at 18:21


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by dessert, Community Jan 2 at 18:21


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • I don't really understand your question, you could read from the file and run the apt command on each read line!

    – George Udosen
    Jan 2 at 13:33











  • LOL, yes, exactly. How? (I'll google that, also, of course.)

    – Thufir
    Jan 2 at 13:35



















  • I don't really understand your question, you could read from the file and run the apt command on each read line!

    – George Udosen
    Jan 2 at 13:33











  • LOL, yes, exactly. How? (I'll google that, also, of course.)

    – Thufir
    Jan 2 at 13:35

















I don't really understand your question, you could read from the file and run the apt command on each read line!

– George Udosen
Jan 2 at 13:33





I don't really understand your question, you could read from the file and run the apt command on each read line!

– George Udosen
Jan 2 at 13:33













LOL, yes, exactly. How? (I'll google that, also, of course.)

– Thufir
Jan 2 at 13:35





LOL, yes, exactly. How? (I'll google that, also, of course.)

– Thufir
Jan 2 at 13:35










2 Answers
2






active

oldest

votes


















6














There is the xargs program which transforms a file to command-line arguments. Simply prepend xargs to the command (with all arguments) for which you’d like to supply additional arguments from the file (let’s call it list.txt) and let xargs to read your file using standard input redirection.



< list.txt xargs sudo apt-get install -y


You can test it by putting echo before (or instead of) sudo or removing the -y option.






share|improve this answer





















  • 1





    I am sorry, I don’t think there is any way to make this command simpler. Every character in this command has its own purpose. The only thing I can simplify is to write apt instead of apt-get.

    – Melebius
    Jan 2 at 14:06





















4














Something like this?



# check that the filename was supplied (keeping it simple for the example)
set -o nounset

packagefile=$1

# initialize the package variable
packages=''

# read the lines of the package file
while IFS= read -r line; do
packs+=" $line"
done < $packagefile

# apt install all of the packages
apt install -y $packs





share|improve this answer
























  • yes, perfect thanks. As an aside, is it possible or advisable to pipe apt search output through a script or utility? Assuming you know ahead of time that the result set is limited. You already answered the question I asked, it's just an aside.

    – Thufir
    Jan 2 at 13:38








  • 1





    You can pipe the output but IMO that's really asking for it since you could get many matches that you didn't intend. I'd recommend outputing to a file first (like: apt search some-pack_name > packages) and then editing that file before doing the install.

    – Eric Mintz
    Jan 2 at 13:57











  • It's the editing which is annoying.

    – Thufir
    Jan 2 at 14:02











  • With bash, it would probably make more sense to slurp all the lines into an array and use that mapfile -t packs < "$packagefile" ; apt-get install -y "${packs[@]}"

    – steeldriver
    Jan 2 at 15:28


















2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









6














There is the xargs program which transforms a file to command-line arguments. Simply prepend xargs to the command (with all arguments) for which you’d like to supply additional arguments from the file (let’s call it list.txt) and let xargs to read your file using standard input redirection.



< list.txt xargs sudo apt-get install -y


You can test it by putting echo before (or instead of) sudo or removing the -y option.






share|improve this answer





















  • 1





    I am sorry, I don’t think there is any way to make this command simpler. Every character in this command has its own purpose. The only thing I can simplify is to write apt instead of apt-get.

    – Melebius
    Jan 2 at 14:06


















6














There is the xargs program which transforms a file to command-line arguments. Simply prepend xargs to the command (with all arguments) for which you’d like to supply additional arguments from the file (let’s call it list.txt) and let xargs to read your file using standard input redirection.



< list.txt xargs sudo apt-get install -y


You can test it by putting echo before (or instead of) sudo or removing the -y option.






share|improve this answer





















  • 1





    I am sorry, I don’t think there is any way to make this command simpler. Every character in this command has its own purpose. The only thing I can simplify is to write apt instead of apt-get.

    – Melebius
    Jan 2 at 14:06
















6












6








6







There is the xargs program which transforms a file to command-line arguments. Simply prepend xargs to the command (with all arguments) for which you’d like to supply additional arguments from the file (let’s call it list.txt) and let xargs to read your file using standard input redirection.



< list.txt xargs sudo apt-get install -y


You can test it by putting echo before (or instead of) sudo or removing the -y option.






share|improve this answer















There is the xargs program which transforms a file to command-line arguments. Simply prepend xargs to the command (with all arguments) for which you’d like to supply additional arguments from the file (let’s call it list.txt) and let xargs to read your file using standard input redirection.



< list.txt xargs sudo apt-get install -y


You can test it by putting echo before (or instead of) sudo or removing the -y option.







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 2 at 14:00

























answered Jan 2 at 13:55









MelebiusMelebius

5,09652040




5,09652040








  • 1





    I am sorry, I don’t think there is any way to make this command simpler. Every character in this command has its own purpose. The only thing I can simplify is to write apt instead of apt-get.

    – Melebius
    Jan 2 at 14:06
















  • 1





    I am sorry, I don’t think there is any way to make this command simpler. Every character in this command has its own purpose. The only thing I can simplify is to write apt instead of apt-get.

    – Melebius
    Jan 2 at 14:06










1




1





I am sorry, I don’t think there is any way to make this command simpler. Every character in this command has its own purpose. The only thing I can simplify is to write apt instead of apt-get.

– Melebius
Jan 2 at 14:06







I am sorry, I don’t think there is any way to make this command simpler. Every character in this command has its own purpose. The only thing I can simplify is to write apt instead of apt-get.

– Melebius
Jan 2 at 14:06















4














Something like this?



# check that the filename was supplied (keeping it simple for the example)
set -o nounset

packagefile=$1

# initialize the package variable
packages=''

# read the lines of the package file
while IFS= read -r line; do
packs+=" $line"
done < $packagefile

# apt install all of the packages
apt install -y $packs





share|improve this answer
























  • yes, perfect thanks. As an aside, is it possible or advisable to pipe apt search output through a script or utility? Assuming you know ahead of time that the result set is limited. You already answered the question I asked, it's just an aside.

    – Thufir
    Jan 2 at 13:38








  • 1





    You can pipe the output but IMO that's really asking for it since you could get many matches that you didn't intend. I'd recommend outputing to a file first (like: apt search some-pack_name > packages) and then editing that file before doing the install.

    – Eric Mintz
    Jan 2 at 13:57











  • It's the editing which is annoying.

    – Thufir
    Jan 2 at 14:02











  • With bash, it would probably make more sense to slurp all the lines into an array and use that mapfile -t packs < "$packagefile" ; apt-get install -y "${packs[@]}"

    – steeldriver
    Jan 2 at 15:28
















4














Something like this?



# check that the filename was supplied (keeping it simple for the example)
set -o nounset

packagefile=$1

# initialize the package variable
packages=''

# read the lines of the package file
while IFS= read -r line; do
packs+=" $line"
done < $packagefile

# apt install all of the packages
apt install -y $packs





share|improve this answer
























  • yes, perfect thanks. As an aside, is it possible or advisable to pipe apt search output through a script or utility? Assuming you know ahead of time that the result set is limited. You already answered the question I asked, it's just an aside.

    – Thufir
    Jan 2 at 13:38








  • 1





    You can pipe the output but IMO that's really asking for it since you could get many matches that you didn't intend. I'd recommend outputing to a file first (like: apt search some-pack_name > packages) and then editing that file before doing the install.

    – Eric Mintz
    Jan 2 at 13:57











  • It's the editing which is annoying.

    – Thufir
    Jan 2 at 14:02











  • With bash, it would probably make more sense to slurp all the lines into an array and use that mapfile -t packs < "$packagefile" ; apt-get install -y "${packs[@]}"

    – steeldriver
    Jan 2 at 15:28














4












4








4







Something like this?



# check that the filename was supplied (keeping it simple for the example)
set -o nounset

packagefile=$1

# initialize the package variable
packages=''

# read the lines of the package file
while IFS= read -r line; do
packs+=" $line"
done < $packagefile

# apt install all of the packages
apt install -y $packs





share|improve this answer













Something like this?



# check that the filename was supplied (keeping it simple for the example)
set -o nounset

packagefile=$1

# initialize the package variable
packages=''

# read the lines of the package file
while IFS= read -r line; do
packs+=" $line"
done < $packagefile

# apt install all of the packages
apt install -y $packs






share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 2 at 13:37









Eric MintzEric Mintz

815412




815412













  • yes, perfect thanks. As an aside, is it possible or advisable to pipe apt search output through a script or utility? Assuming you know ahead of time that the result set is limited. You already answered the question I asked, it's just an aside.

    – Thufir
    Jan 2 at 13:38








  • 1





    You can pipe the output but IMO that's really asking for it since you could get many matches that you didn't intend. I'd recommend outputing to a file first (like: apt search some-pack_name > packages) and then editing that file before doing the install.

    – Eric Mintz
    Jan 2 at 13:57











  • It's the editing which is annoying.

    – Thufir
    Jan 2 at 14:02











  • With bash, it would probably make more sense to slurp all the lines into an array and use that mapfile -t packs < "$packagefile" ; apt-get install -y "${packs[@]}"

    – steeldriver
    Jan 2 at 15:28



















  • yes, perfect thanks. As an aside, is it possible or advisable to pipe apt search output through a script or utility? Assuming you know ahead of time that the result set is limited. You already answered the question I asked, it's just an aside.

    – Thufir
    Jan 2 at 13:38








  • 1





    You can pipe the output but IMO that's really asking for it since you could get many matches that you didn't intend. I'd recommend outputing to a file first (like: apt search some-pack_name > packages) and then editing that file before doing the install.

    – Eric Mintz
    Jan 2 at 13:57











  • It's the editing which is annoying.

    – Thufir
    Jan 2 at 14:02











  • With bash, it would probably make more sense to slurp all the lines into an array and use that mapfile -t packs < "$packagefile" ; apt-get install -y "${packs[@]}"

    – steeldriver
    Jan 2 at 15:28

















yes, perfect thanks. As an aside, is it possible or advisable to pipe apt search output through a script or utility? Assuming you know ahead of time that the result set is limited. You already answered the question I asked, it's just an aside.

– Thufir
Jan 2 at 13:38







yes, perfect thanks. As an aside, is it possible or advisable to pipe apt search output through a script or utility? Assuming you know ahead of time that the result set is limited. You already answered the question I asked, it's just an aside.

– Thufir
Jan 2 at 13:38






1




1





You can pipe the output but IMO that's really asking for it since you could get many matches that you didn't intend. I'd recommend outputing to a file first (like: apt search some-pack_name > packages) and then editing that file before doing the install.

– Eric Mintz
Jan 2 at 13:57





You can pipe the output but IMO that's really asking for it since you could get many matches that you didn't intend. I'd recommend outputing to a file first (like: apt search some-pack_name > packages) and then editing that file before doing the install.

– Eric Mintz
Jan 2 at 13:57













It's the editing which is annoying.

– Thufir
Jan 2 at 14:02





It's the editing which is annoying.

– Thufir
Jan 2 at 14:02













With bash, it would probably make more sense to slurp all the lines into an array and use that mapfile -t packs < "$packagefile" ; apt-get install -y "${packs[@]}"

– steeldriver
Jan 2 at 15:28





With bash, it would probably make more sense to slurp all the lines into an array and use that mapfile -t packs < "$packagefile" ; apt-get install -y "${packs[@]}"

– steeldriver
Jan 2 at 15:28



Popular posts from this blog

To store a contact into the json file from server.js file using a class in NodeJS

Redirect URL with Chrome Remote Debugging Android Devices

Dieringhausen