Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
30
rated 0 times [  30] [ 0]  / answers: 1 / hits: 15641  / 2 Years ago, tue, september 13, 2022, 12:09:22

When I try to install a package, for instance nsnake, with the command sudo apt-get install nsnake &, the process immediately stops. I can bring it to the foreground and enter my sudo password, pause it (with Ctrl-Z), and send it back to the background again. But then the shell will immediately pause the process, e.g.,



katriel@caseylaptop:~$ bg     
[2]+ sudo apt-get install nsnake &
[2]+ Stopped sudo apt-get install nsnake


Is it possible to install packages in the background? I may want to do this while installing large packages on a computer I'm SSH'ing into.


More From » apt

 Answers
2

Yes, sure.



Perform your apt-get command with fancy things around it



sudo bash -c 'apt-get -y install guake >/dev/null 2>&1 & disown'


Part explanation:




  • The sudo bash -c part spawns a new bash process, and runs apt-get -y install guake >/dev/null 2>&1 & disown inside that new shell.


  • These commands are then run inside the new subshell:




    • apt-get -y install guake: The main apt-get command you want to run.




      • >/dev/null 2>&1 pipes stdout and stderr to /dev/null.


    • & disown disowns the preceding job and exits the subshell.



[#26971] Wednesday, September 14, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
fertion

Total Points: 436
Total Questions: 121
Total Answers: 156

Location: England
Member since Sun, May 21, 2023
1 Year ago
fertion questions
Thu, Mar 9, 23, 06:46, 1 Year ago
Thu, Jun 17, 21, 01:06, 3 Years ago
Mon, Jun 13, 22, 07:30, 2 Years ago
Fri, Mar 10, 23, 12:13, 1 Year ago
;