etc directory
For tracking changes to your /etc directory you can do as @Anthon has suggested and use git, subversion, mercurial, etc. to version control that directory. You can also use a tool such as etckeeper. There's a tutorial here as well as here.
etckeeper is a collection of tools to let /etc be stored in a git,
mercurial, bazaar or darcs repository. It hooks into apt to
automatically commit changes made to /etc during package upgrades. It
tracks file metadata that git does not normally support, but that is
important for /etc, such as the permissions of /etc/shadow. It's
quite modular and configurable, while also being simple to use if you
understand the basics of working with version control.
package files
To my knowledge apt does not have a way to check the files on disk vs. the files that are in the actual .deb. Neither does dpkg, the tool that apt is actually using to do the management of files.
However you can use a tool such as debsums to compare some of the files you have installed, it only looks at their checksums (md5sum) of what's in the .deb file vs. what's on your systems disk.
See this serverfault question for more details about debsum and dpkg checksumming, as well as this askubuntu question.
debsum example
% debsums openssh-server
/usr/lib/openssh/sftp-server OK
/usr/sbin/sshd OK
/usr/share/lintian/overrides/openssh-server OK
/usr/share/man/man5/sshd_config.5.gz OK
/usr/share/man/man8/sshd.8.gz OK
/usr/share/man/man8/sftp-server.8.gz OK
/etcunder revision control (I use mercurial for that) andaddandcommiton a regular basis. That way you can roll back to original files, or to intermediate changed states and withhg diffyou can see changes. If you cannot find a way to do this withapt, backup your changed files, reinstall the packag(es), bring the config files under revision control and copy back your changes. After that you can do a diff. – Anthon Apr 17 '13 at 11:03diff. – reinierpost May 22 '15 at 11:08etckeeperinstead of some "manual" approach (or at least recommend it over the manual approach). It deals with some of the idiosyncrasies of/etcout of the box and supports several version control systems, including Mercurial. – 0xC0000022L Nov 19 '18 at 19:02