for example: Samba installed a lot of files in /usr/lib and /usr/share and other places.

Does apt-get upgrade deletes the old versions of the Samba folders/files?


Of course it does. All files that are present in the package itself get updated when you update the package. This includes removal of obsolete files.

However, files that got created by the post-installation scripts will not be replaced or removed during a package update, unless it's specified in the pre-/post-installation scripts of the new version. They should get removed when you remove/purge the package later though.

Files created later while using the application (like user data, settings, cache, ...) are not maintained by the package manager though. If you purge a package, its removal scripts could take care of getting rid of those files, but don't necessarily have to. Stuff created in your home directory usually remains untouched.

However, all those installation/removal scripts are made by the package author and can include or miss commands to remove some files, depending on how thorough this person worked.

| improve this answer | |
  • If you purge a package, its removal scripts should take care of geetting rid of those files. does purge remove user settings? – Anwar Aug 30 '16 at 16:34
  • 1
    @Anwar AFAIK, purging a package removes its system-wide config files, but user-specific config files in each user's home directory may stay untouched. – Byte Commander Aug 30 '16 at 18:04
  • You might want to edit the third para? that was actually confusing – Anwar Aug 30 '16 at 18:09
  • @Anwar Done. Better now? – Byte Commander Aug 30 '16 at 19:01
  • Yes.it is now. User data generally reside in home and don't get deleted. however other system wide configuration files such as those in /etc usually stay with remove. purge. cleans them – Anwar Aug 30 '16 at 19:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.