Do not ask me why, but I often found myself installing a Linux distribution (e.g. Ubuntu) over and over again in a year time. For myself or others.
I often found myself installing the same application to get my system up and running. Since only one installing process can acces my system at a time, I have to wait for one installation to finish in my terminal for me to install a new program in the terminal.
user@computer:~$ sudo apt-get install [application]
E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?This is inefficient since I have to keep an eye on my terminal and wait for it to finish. That's the reason I wonder:
1. Can you create a queue in the terminal so that after one installation finishes it will continue to the next?
2. Can you write a script to do this? How would it look like?
My last question which, is kind of a longshot, is there a way that you can see what is installed and automatically add this to a script or something. All of this is part of my soft-backup plan. If I ruin my system and corrupt my files, I can always return to stock ubuntu in under an hour.
1 Answer
- Can you create a queue in the terminal so that after one installation finishes it will continue to the next?
Yes. You can add packages like this:
sudo apt-get install sm-player vlc chromium
- Can you write a script to do this? How would it look like?
Yes. Just put above mentioned one-liner into a text file and make it executable with chmod 664 textfile. You can then do ./textfile and it will start installing. It might be smart to add a --yes in the command otherwise it will prompt for confirmation.
You can add a lot more to such a script. You can even add gsettings. See How do I make post-install scripts? for an example.
My last question which, is kind of a longshot, is there a way that you can see what is installed and automatically add this to a script or something.
Yes. See: