4

When running the command apt-get I got all the possible options and commands for apt-get. But one of these commands and definitions I have not seen before:

dselect-upgrade - Follow dselect selections

I ran the command sudo apt-get dselect-upgrade just to see what happened and this was the output:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

So what does this command actually do? And what does it mean to Follow dselect sections?

1
  • 2
    this is a simple question with a simple answer. Before asking, next time run the command man <command> | grep <item>, or search google for "man apt-get"
    – Tim
    Feb 14, 2015 at 10:23

3 Answers 3

2

As others have pointed out, it "follows dselect choices". One nice thing about this, is one can feed a list of packages selections to dpkg:

dpkg --clear-selections
dpkg --set-selections < package_choice_list

then do "apt-get dselect-upgrade" and it will remove anything not in the list, and install everything in the list. I don't think any other package tool can do that. It gives one a way to ensure "these and only these" packages are installed, which is very convenient.

1

Source: man apt-get

dselect-upgrade
       dselect-upgrade is used in conjunction with the traditional Debian
       packaging front-end, dselect(1).  dselect-upgrade follows the
       changes made by dselect(1) to the Status field of available
       packages, and performs the actions necessary to realize that state
       (for instance, the removal of old and the installation of new
       packages).

So the question you're really after is "What is dselect?" and this used to be a way to use the capacity of Debian packages for suggesting other packages for installation back when dinosaurs used to roam the Earth. It does still work and even has its niches where it's still used, but nowadays there are easier ways to accomplish the same thing.

For a beginner's tutorial, look here.

3
  • 1
    Could you explain what that means?
    – Tim
    Feb 14, 2015 at 9:53
  • 1
    @Tim: This was just a sneaky answer to Toroidal himself, who I have told numerous times in the chat room to RTFM before asking questions... But you're right: it's on AU, so the answer should be a complete one! ;-)
    – Fabby
    Feb 14, 2015 at 10:21
  • 1
    Can also be used with aptitude selections. Feb 14, 2015 at 19:18
1

What I know is that dselect is used in backing up our system.

You can also use it to install the same packages in any other system as yours.

dpkg --get-selection > packages.list This will create a list of all the packages installed in your system in the packages.list file.

Now, if something happens and your system crashes, you can install all the packages which were in your system with the help of this packages.list file.

dpkg --set-selections < packages.list

sudo apt-get dselect-upgrade

This will do the thing for you. It will install all the packages which were in your system before.

If you want to install same packages on your another system, then transfer this file to that system, and run those 2 commands. It will do the trick for you.

2
  • Your post really explains why the option is there! There is a mistake: dpkg --get-selection should actually be dpkg --get-selections. I'd add the missing 's', but edits must be at least 6 chars long...
    – Ilario
    Aug 21, 2019 at 8:51
  • Typo --get-selection should be --get-selections, but AskUbuntu has a restriction that prevents single-character edits (which is stupid for a troubleshooting page dealing with terminal commands).
    – nh2
    Sep 29, 2019 at 17:21

You must log in to answer this question.