Final:

(PKG="linux"; dpkg -l | grep $PKG | awk '{print $2}' | xargs -I %%  /bin/bash -c 'echo "---%%----"; dpkg -L "%%" | xargs -I @@ /bin/bash -c "[[ -f '@@' ]] && ls -lisah '@@'"' | nl > /tmp/${PKG}.pktxt; cat /tmp/${PKG}.pktxt; )

Use this same technique to find out which files are missing from packages: http://www.infotinks.com/see-filesfolderssymlinksetc-missing-debian-package/

————–

For example all of the packages that are mono. I want to see all of the files.

Here is all of the packages listed with dpkg -l:

# dpkg -l | grep mono
ii  libmono-corlib4.0-cil               2.10.8.1-8+deb7u1                 all          Mono core library (for CLI 4.0)
ii  libmono-security4.0-cil             2.10.8.1-8+deb7u1                 all          Mono Security library (for CLI 4.0)
ii  libmono-system-configuration4.0-cil 2.10.8.1-8+deb7u1                 all          Mono System.Configuration library (for CLI 4.0)
ii  libmono-system-security4.0-cil      2.10.8.1-8+deb7u1                 all          Mono System.Security library (for CLI 4.0)
ii  libmono-system-xml4.0-cil           2.10.8.1-8+deb7u1                 all          Mono System.Xml library (for CLI 4.0)
ii  libmono-system4.0-cil               2.10.8.1-8+deb7u1                 all          Mono System libraries (for CLI 4.0)
ii  mono-4.0-gac                        2.10.8.1-8+deb7u1                 all          Mono GAC tool (for CLI 4.0)
ii  mono-gac                            2.10.8.1-8+deb7u1                 all          Mono GAC tool
ii  mono-runtime                        2.10.8.1-8+deb7u1                 amd64        Mono runtime

Now the package name (which is what we need) is in the 2nd column, so lets grab it with awk.

# dpkg -l | grep mono | awk '{print $2}'
libmono-corlib4.0-cil
libmono-security4.0-cil
libmono-system-configuration4.0-cil
libmono-system-security4.0-cil
libmono-system-xml4.0-cil
libmono-system4.0-cil
mono-4.0-gac
mono-gac
mono-runtime

Next… recall that if you dpkg -L packagename , it will list all of its installed files and folders.

Sidenote / Example:

# dpkg -L vim
/.
/usr
/usr/bin
/usr/bin/vim.basic
/usr/share
/usr/share/doc
/usr/share/bug
/usr/share/bug/vim
/usr/share/bug/vim/script
/usr/share/bug/vim/presubj
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/vim
/usr/share/doc/vim

So lets pipe all of those package names extracted from dpkg -l & awk into a loop. Instead of doing a for loop (which is slow and launches bash everytime). Lets pipe it into xargs (that way its faster, and feels like a single command – which we will be proud of when we are done). Each package name will be piped as %% into xargs and it will run that dpkg -L %% one time per line (once for each of those 9 mono entries).

# dpkg -l | grep mono | awk '{print $2}' | xargs -I %%  bash -c 'dpkg -L %%'
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libmono-corlib4.0-cil
/usr/share/doc/libmono-corlib4.0-cil/changelog.Debian.gz
/usr/share/doc/libmono-corlib4.0-cil/copyright
/usr/lib
/usr/lib/mono
/usr/lib/mono/4.0
/usr/lib/mono/4.0/mscorlib.dll
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libmono-security4.0-cil
/usr/share/doc/libmono-security4.0-cil/changelog.Debian.gz
/usr/share/doc/libmono-security4.0-cil/copyright
/usr/lib
/usr/lib/mono
/usr/lib/mono/gac
/usr/lib/mono/gac/Mono.Security
/usr/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756
/usr/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll
/usr/lib/mono/4.0
/usr/lib/mono/4.0/Mono.Security.dll
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libmono-system-configuration4.0-cil
/usr/share/doc/libmono-system-configuration4.0-cil/changelog.Debian.gz
/usr/share/doc/libmono-system-configuration4.0-cil/copyright
/usr/lib
/usr/lib/mono
/usr/lib/mono/gac
/usr/lib/mono/gac/System.Configuration
/usr/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a
/usr/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
/usr/lib/mono/4.0
/usr/lib/mono/4.0/System.Configuration.dll
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libmono-system-security4.0-cil
/usr/share/doc/libmono-system-security4.0-cil/changelog.Debian.gz
/usr/share/doc/libmono-system-security4.0-cil/copyright
/usr/lib
/usr/lib/mono
/usr/lib/mono/gac
/usr/lib/mono/gac/System.Security
/usr/lib/mono/gac/System.Security/4.0.0.0__b03f5f7f11d50a3a
/usr/lib/mono/gac/System.Security/4.0.0.0__b03f5f7f11d50a3a/System.Security.dll
/usr/lib/mono/4.0
/usr/lib/mono/4.0/System.Security.dll
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libmono-system-xml4.0-cil
/usr/share/doc/libmono-system-xml4.0-cil/changelog.Debian.gz
/usr/share/doc/libmono-system-xml4.0-cil/copyright
/usr/lib
/usr/lib/mono
/usr/lib/mono/gac
/usr/lib/mono/gac/System.Xml
/usr/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089
/usr/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll
/usr/lib/mono/4.0
/usr/lib/mono/4.0/System.Xml.dll
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libmono-system4.0-cil
/usr/share/doc/libmono-system4.0-cil/changelog.Debian.gz
/usr/share/doc/libmono-system4.0-cil/copyright
/usr/lib
/usr/lib/mono
/usr/lib/mono/gac
/usr/lib/mono/gac/System
/usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089
/usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll
/usr/lib/mono/4.0
/usr/lib/mono/4.0/System.dll
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/mono-4.0-gac
/usr/share/doc/mono-4.0-gac/changelog.Debian.gz
/usr/share/doc/mono-4.0-gac/copyright
/usr/lib
/usr/lib/mono
/usr/lib/mono/4.0
/usr/lib/mono/4.0/gacutil.exe
/.
/usr
/usr/bin
/usr/bin/gacutil
/usr/share
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/gacutil.1.gz
/usr/share/doc
/usr/share/doc/mono-gac
/usr/share/doc/mono-gac/changelog.Debian.gz
/usr/share/doc/mono-gac/copyright
/usr/share/mono
/usr/share/mono/MonoGetAssemblyName.exe
/usr/share/cli-common
/usr/share/cli-common/runtimes.d
/usr/share/cli-common/runtimes.d/mono
/.
/etc
/etc/mono
/etc/mono/4.0
/etc/mono/4.0/machine.config
/etc/mono/4.0/web.config
/etc/mono/4.0/DefaultWsdlHelpGenerator.aspx
/etc/mono/4.0/settings.map
/etc/mono/2.0
/etc/mono/2.0/Browsers
/etc/mono/2.0/Browsers/Compat.browser
/etc/mono/2.0/machine.config
/etc/mono/2.0/web.config
/etc/mono/2.0/DefaultWsdlHelpGenerator.aspx
/etc/mono/2.0/settings.map
/etc/mono/config
/etc/mono/browscap.ini
/usr
/usr/lib
/usr/lib/libMonoSupportW.so
/usr/lib/libMonoPosixHelper.so
/usr/lib/cli
/usr/lib/cli/binfmt-detector-cli
/usr/share
/usr/share/man
/usr/share/man/man5
/usr/share/man/man5/mono-config.5.gz
/usr/share/man/man1
/usr/share/man/man1/cli-wrapper.1.gz
/usr/share/man/man1/mono.1.gz
/usr/share/doc
/usr/share/doc/mono-runtime
/usr/share/doc/mono-runtime/changelog.Debian.gz
/usr/share/doc/mono-runtime/NEWS.Debian.gz
/usr/share/doc/mono-runtime/changelog.gz
/usr/share/doc/mono-runtime/README.gz
/usr/share/doc/mono-runtime/NEWS.gz
/usr/share/doc/mono-runtime/changelog.1.gz
/usr/share/doc/mono-runtime/copyright
/usr/share/doc/mono-runtime/README.Debian
/usr/share/doc/mono-runtime/AUTHORS
/usr/share/applications
/usr/share/applications/mono-runtime-terminal.desktop
/usr/share/applications/mono-runtime.desktop
/usr/share/pixmaps
/usr/share/pixmaps/mono-runtime.png
/usr/share/mono-2.0
/usr/share/mono-2.0/mono
/usr/share/mono-2.0/mono/cil
/usr/share/mono-2.0/mono/cil/cil-opcodes.xml
/usr/share/dotnet
/usr/share/binfmts
/usr/share/binfmts/cli
/usr/bin
/usr/bin/mono

There we go… except 1) its hard to tell which file belongs to which package -> solution add a header line before it starts listing the files. 2) it lists files and folders. we just want the files.

Lets add that header.

# dpkg -l | grep mono | awk '{print $2}' | xargs -I %%  /bin/bash -c 'echo ---%%----; dpkg -L %%;'
---libmono-corlib4.0-cil----
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libmono-corlib4.0-cil
/usr/share/doc/libmono-corlib4.0-cil/changelog.Debian.gz
/usr/share/doc/libmono-corlib4.0-cil/copyright
/usr/lib
/usr/lib/mono
/usr/lib/mono/4.0
/usr/lib/mono/4.0/mscorlib.dll
---libmono-security4.0-cil----
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libmono-security4.0-cil
/usr/share/doc/libmono-security4.0-cil/changelog.Debian.gz
/usr/share/doc/libmono-security4.0-cil/copyright
/usr/lib
/usr/lib/mono
/usr/lib/mono/gac
/usr/lib/mono/gac/Mono.Security
/usr/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756
/usr/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll
/usr/lib/mono/4.0
/usr/lib/mono/4.0/Mono.Security.dll
---libmono-system-configuration4.0-cil----
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libmono-system-configuration4.0-cil
/usr/share/doc/libmono-system-configuration4.0-cil/changelog.Debian.gz
/usr/share/doc/libmono-system-configuration4.0-cil/copyright
/usr/lib
/usr/lib/mono
/usr/lib/mono/gac
/usr/lib/mono/gac/System.Configuration
/usr/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a
/usr/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
/usr/lib/mono/4.0
/usr/lib/mono/4.0/System.Configuration.dll
---libmono-system-security4.0-cil----
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libmono-system-security4.0-cil
/usr/share/doc/libmono-system-security4.0-cil/changelog.Debian.gz
/usr/share/doc/libmono-system-security4.0-cil/copyright
/usr/lib
/usr/lib/mono
/usr/lib/mono/gac
/usr/lib/mono/gac/System.Security
/usr/lib/mono/gac/System.Security/4.0.0.0__b03f5f7f11d50a3a
/usr/lib/mono/gac/System.Security/4.0.0.0__b03f5f7f11d50a3a/System.Security.dll
/usr/lib/mono/4.0
/usr/lib/mono/4.0/System.Security.dll
---libmono-system-xml4.0-cil----
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libmono-system-xml4.0-cil
/usr/share/doc/libmono-system-xml4.0-cil/changelog.Debian.gz
/usr/share/doc/libmono-system-xml4.0-cil/copyright
/usr/lib
/usr/lib/mono
/usr/lib/mono/gac
/usr/lib/mono/gac/System.Xml
/usr/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089
/usr/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll
/usr/lib/mono/4.0
/usr/lib/mono/4.0/System.Xml.dll
---libmono-system4.0-cil----
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/libmono-system4.0-cil
/usr/share/doc/libmono-system4.0-cil/changelog.Debian.gz
/usr/share/doc/libmono-system4.0-cil/copyright
/usr/lib
/usr/lib/mono
/usr/lib/mono/gac
/usr/lib/mono/gac/System
/usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089
/usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll
/usr/lib/mono/4.0
/usr/lib/mono/4.0/System.dll
---mono-4.0-gac----
/.
/usr
/usr/share
/usr/share/doc
/usr/share/doc/mono-4.0-gac
/usr/share/doc/mono-4.0-gac/changelog.Debian.gz
/usr/share/doc/mono-4.0-gac/copyright
/usr/lib
/usr/lib/mono
/usr/lib/mono/4.0
/usr/lib/mono/4.0/gacutil.exe
---mono-gac----
/.
/usr
/usr/bin
/usr/bin/gacutil
/usr/share
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/gacutil.1.gz
/usr/share/doc
/usr/share/doc/mono-gac
/usr/share/doc/mono-gac/changelog.Debian.gz
/usr/share/doc/mono-gac/copyright
/usr/share/mono
/usr/share/mono/MonoGetAssemblyName.exe
/usr/share/cli-common
/usr/share/cli-common/runtimes.d
/usr/share/cli-common/runtimes.d/mono
---mono-runtime----
/.
/etc
/etc/mono
/etc/mono/4.0
/etc/mono/4.0/machine.config
/etc/mono/4.0/web.config
/etc/mono/4.0/DefaultWsdlHelpGenerator.aspx
/etc/mono/4.0/settings.map
/etc/mono/2.0
/etc/mono/2.0/Browsers
/etc/mono/2.0/Browsers/Compat.browser
/etc/mono/2.0/machine.config
/etc/mono/2.0/web.config
/etc/mono/2.0/DefaultWsdlHelpGenerator.aspx
/etc/mono/2.0/settings.map
/etc/mono/config
/etc/mono/browscap.ini
/usr
/usr/lib
/usr/lib/libMonoSupportW.so
/usr/lib/libMonoPosixHelper.so
/usr/lib/cli
/usr/lib/cli/binfmt-detector-cli
/usr/share
/usr/share/man
/usr/share/man/man5
/usr/share/man/man5/mono-config.5.gz
/usr/share/man/man1
/usr/share/man/man1/cli-wrapper.1.gz
/usr/share/man/man1/mono.1.gz
/usr/share/doc
/usr/share/doc/mono-runtime
/usr/share/doc/mono-runtime/changelog.Debian.gz
/usr/share/doc/mono-runtime/NEWS.Debian.gz
/usr/share/doc/mono-runtime/changelog.gz
/usr/share/doc/mono-runtime/README.gz
/usr/share/doc/mono-runtime/NEWS.gz
/usr/share/doc/mono-runtime/changelog.1.gz
/usr/share/doc/mono-runtime/copyright
/usr/share/doc/mono-runtime/README.Debian
/usr/share/doc/mono-runtime/AUTHORS
/usr/share/applications
/usr/share/applications/mono-runtime-terminal.desktop
/usr/share/applications/mono-runtime.desktop
/usr/share/pixmaps
/usr/share/pixmaps/mono-runtime.png
/usr/share/mono-2.0
/usr/share/mono-2.0/mono
/usr/share/mono-2.0/mono/cil
/usr/share/mono-2.0/mono/cil/cil-opcodes.xml
/usr/share/dotnet
/usr/share/binfmts
/usr/share/binfmts/cli
/usr/bin
/usr/bin/mono

Now lets filter out the files. We can send the output of each dpkg -L into another xargs that tests to see if the file is a regular file (not directory, not link). We used %% so we have to use something new like @@ (be careful not to use ## or $$ those chars are used by the system for other things, so becareful and think ahead). So every entry (file or folder) will run thru this: [[ -f @@ ]] && ls -lisah @@  (replace @@ with a file name and you will see that it tests if @@ and if it is a file it will return true, so the part after && is run which will write on the screen the output of ls -lisah @@ , if its not a file the the part after && is not run and nothing is output for that entry and it continue to next entry to see if its a regular file or not)

NOTE: test -f FILE && echo “true” || echo “false” or [[ -f FILE ]] && echo “true” || echo “false”  will return true if its a regular file and not a device file (so it will return true for files, hard links, and symlinks )

# dpkg -l | grep mono | awk '{print $2}' | xargs -I %%  /bin/bash -c 'echo ---%%----; dpkg -L %% | xargs -I @@ /bin/bash -c "[[ -f @@ ]] && ls -lisah @@"'
---libmono-corlib4.0-cil----
1924032 12K -rw-r--r-- 1 root root 8.1K Mar 19  2015 /usr/share/doc/libmono-corlib4.0-cil/changelog.Debian.gz
1924033 24K -rw-r--r-- 1 root root 23K Mar 19  2015 /usr/share/doc/libmono-corlib4.0-cil/copyright
1924034 2.8M -rw-r--r-- 1 root root 2.8M Mar 19  2015 /usr/lib/mono/4.0/mscorlib.dll
---libmono-security4.0-cil----
1923916 12K -rw-r--r-- 1 root root 8.1K Mar 19  2015 /usr/share/doc/libmono-security4.0-cil/changelog.Debian.gz
1923917 24K -rw-r--r-- 1 root root 23K Mar 19  2015 /usr/share/doc/libmono-security4.0-cil/copyright
1923920 284K -rw-r--r-- 1 root root 282K Mar 19  2015 /usr/lib/mono/gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll
1923922 4.0K lrwxrwxrwx 1 root root 64 Mar 19  2015 /usr/lib/mono/4.0/Mono.Security.dll -> ../gac/Mono.Security/4.0.0.0__0738eb9f132ed756/Mono.Security.dll
---libmono-system-configuration4.0-cil----
1923882 12K -rw-r--r-- 1 root root 8.1K Mar 19  2015 /usr/share/doc/libmono-system-configuration4.0-cil/changelog.Debian.gz
1923883 24K -rw-r--r-- 1 root root 23K Mar 19  2015 /usr/share/doc/libmono-system-configuration4.0-cil/copyright
1923886 124K -rw-r--r-- 1 root root 122K Mar 19  2015 /usr/lib/mono/gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
1923887 4.0K lrwxrwxrwx 1 root root 78 Mar 19  2015 /usr/lib/mono/4.0/System.Configuration.dll -> ../gac/System.Configuration/4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
---libmono-system-security4.0-cil----
1923864 12K -rw-r--r-- 1 root root 8.1K Mar 19  2015 /usr/share/doc/libmono-system-security4.0-cil/changelog.Debian.gz
1923865 24K -rw-r--r-- 1 root root 23K Mar 19  2015 /usr/share/doc/libmono-system-security4.0-cil/copyright
1923868 132K -rw-r--r-- 1 root root 130K Mar 19  2015 /usr/lib/mono/gac/System.Security/4.0.0.0__b03f5f7f11d50a3a/System.Security.dll
1923869 4.0K lrwxrwxrwx 1 root root 68 Mar 19  2015 /usr/lib/mono/4.0/System.Security.dll -> ../gac/System.Security/4.0.0.0__b03f5f7f11d50a3a/System.Security.dll
---libmono-system-xml4.0-cil----
1923843 12K -rw-r--r-- 1 root root 8.1K Mar 19  2015 /usr/share/doc/libmono-system-xml4.0-cil/changelog.Debian.gz
1923844 24K -rw-r--r-- 1 root root 23K Mar 19  2015 /usr/share/doc/libmono-system-xml4.0-cil/copyright
1923849 1.3M -rw-r--r-- 1 root root 1.3M Mar 19  2015 /usr/lib/mono/gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll
1923851 4.0K lrwxrwxrwx 1 root root 58 Mar 19  2015 /usr/lib/mono/4.0/System.Xml.dll -> ../gac/System.Xml/4.0.0.0__b77a5c561934e089/System.Xml.dll
---libmono-system4.0-cil----
1923900 12K -rw-r--r-- 1 root root 8.1K Mar 19  2015 /usr/share/doc/libmono-system4.0-cil/changelog.Debian.gz
1923901 24K -rw-r--r-- 1 root root 23K Mar 19  2015 /usr/share/doc/libmono-system4.0-cil/copyright
1923904 1.7M -rw-r--r-- 1 root root 1.7M Mar 19  2015 /usr/lib/mono/gac/System/4.0.0.0__b77a5c561934e089/System.dll
1923905 4.0K lrwxrwxrwx 1 root root 50 Mar 19  2015 /usr/lib/mono/4.0/System.dll -> ../gac/System/4.0.0.0__b77a5c561934e089/System.dll
---mono-4.0-gac----
1923933 12K -rw-r--r-- 1 root root 8.1K Mar 19  2015 /usr/share/doc/mono-4.0-gac/changelog.Debian.gz
1923934 24K -rw-r--r-- 1 root root 23K Mar 19  2015 /usr/share/doc/mono-4.0-gac/copyright
1923935 28K -rwxr-xr-x 1 root root 27K Mar 19  2015 /usr/lib/mono/4.0/gacutil.exe
---mono-gac----
1923949 4.0K -rwxr-xr-x 1 root root 78 Mar 19  2015 /usr/bin/gacutil
1923950 4.0K -rw-r--r-- 1 root root 1.9K Mar 19  2015 /usr/share/man/man1/gacutil.1.gz
1923952 12K -rw-r--r-- 1 root root 8.1K Mar 19  2015 /usr/share/doc/mono-gac/changelog.Debian.gz
1923953 24K -rw-r--r-- 1 root root 23K Mar 19  2015 /usr/share/doc/mono-gac/copyright
1923955 4.0K -rwxr-xr-x 1 root root 3.5K Mar 19  2015 /usr/share/mono/MonoGetAssemblyName.exe
1923958 4.0K -rwxr-xr-x 1 root root 3.2K Mar 19  2015 /usr/share/cli-common/runtimes.d/mono
---mono-runtime----
1923975 36K -rw-r--r-- 1 root root 33K Mar 19  2015 /etc/mono/4.0/machine.config
1923976 20K -rw-r--r-- 1 root root 19K Mar 19  2015 /etc/mono/4.0/web.config
1923977 60K -rw-r--r-- 1 root root 60K Mar 19  2015 /etc/mono/4.0/DefaultWsdlHelpGenerator.aspx
1923978 4.0K -rw-r--r-- 1 root root 2.6K Mar 19  2015 /etc/mono/4.0/settings.map
1923981 4.0K -rw-r--r-- 1 root root 1.6K Mar 19  2015 /etc/mono/2.0/Browsers/Compat.browser
1923982 32K -rw-r--r-- 1 root root 29K Mar 19  2015 /etc/mono/2.0/machine.config
1923983 12K -rw-r--r-- 1 root root 12K Mar 19  2015 /etc/mono/2.0/web.config
1923984 60K -rw-r--r-- 1 root root 60K Mar 19  2015 /etc/mono/2.0/DefaultWsdlHelpGenerator.aspx
1923985 4.0K -rw-r--r-- 1 root root 2.6K Mar 19  2015 /etc/mono/2.0/settings.map
1923986 4.0K -rw-r--r-- 1 root root 1.8K Mar 19  2015 /etc/mono/config
1923987 308K -rw-r--r-- 1 root root 305K Mar 19  2015 /etc/mono/browscap.ini
1923988 132K -rw-r--r-- 1 root root 132K Mar 19  2015 /usr/lib/libMonoSupportW.so
1923989 236K -rw-r--r-- 1 root root 233K Mar 19  2015 /usr/lib/libMonoPosixHelper.so
1923991 8.0K -rwxr-xr-x 1 root root 6.1K Mar 19  2015 /usr/lib/cli/binfmt-detector-cli
1923992 4.0K -rw-r--r-- 1 root root 1.9K Mar 19  2015 /usr/share/man/man5/mono-config.5.gz
1923993 4.0K -rw-r--r-- 1 root root 281 Mar 19  2015 /usr/share/man/man1/cli-wrapper.1.gz
1923994 24K -rw-r--r-- 1 root root 21K Mar 19  2015 /usr/share/man/man1/mono.1.gz
1923996 12K -rw-r--r-- 1 root root 8.1K Mar 19  2015 /usr/share/doc/mono-runtime/changelog.Debian.gz
1923997 4.0K -rw-r--r-- 1 root root 2.9K Mar 19  2015 /usr/share/doc/mono-runtime/NEWS.Debian.gz
1923998 4.0K -rw-r--r-- 1 root root 2.2K Dec 19  2011 /usr/share/doc/mono-runtime/changelog.gz
1923999 8.0K -rw-r--r-- 1 root root 6.3K Dec 19  2011 /usr/share/doc/mono-runtime/README.gz
1924000 4.0K -rw-r--r-- 1 root root 158 Dec 19  2011 /usr/share/doc/mono-runtime/NEWS.gz
1924001 32K -rw-r--r-- 1 root root 30K Mar 19  2015 /usr/share/doc/mono-runtime/changelog.1.gz
1924002 24K -rw-r--r-- 1 root root 23K Mar 19  2015 /usr/share/doc/mono-runtime/copyright
1924003 4.0K -rw-r--r-- 1 root root 2.9K Jul 31  2014 /usr/share/doc/mono-runtime/README.Debian
1924004 4.0K -rw-r--r-- 1 root root 104 Dec 19  2011 /usr/share/doc/mono-runtime/AUTHORS
1924005 4.0K -rw-r--r-- 1 root root 161 Mar 19  2015 /usr/share/applications/mono-runtime-terminal.desktop
1924006 4.0K -rw-r--r-- 1 root root 151 Mar 19  2015 /usr/share/applications/mono-runtime.desktop
1924007 20K -rw-r--r-- 1 root root 20K Mar 19  2015 /usr/share/pixmaps/mono-runtime.png
1924011 40K -rw-r--r-- 1 root root 37K Mar 19  2015 /usr/share/mono-2.0/mono/cil/cil-opcodes.xml
1924013 4.0K -rw-r--r-- 1 root root 98 Mar 19  2015 /usr/share/binfmts/cli
1924015 3.0M -rwxr-xr-x 1 root root 3.0M Mar 19  2015 /usr/bin/mono

This next one should handle files with spaces better, because we quote around the files. Note that we quote files with single quotes inside double quotes. And quote files with double quotes inside single quotes.

dpkg -l | grep mono | awk '{print $2}' | xargs -I %%  /bin/bash -c 'echo "---%%----"; dpkg -L "%%" | xargs -I @@ /bin/bash -c "[[ -f '@@' ]] && ls -lisah '@@'"'

Now that is a double xargs to be proud of. Its like a double loop. We are done.

Another way to do this is with a loop (which might handle files with spaces better). Notice that I put the whole thing in a subshell so that we don’t create or interfere with environment by setting package variable and f variable (those are my loop variables, that change with each succession of the loop). Also I set IFS=$’\n’  so that the for loop doesnt consider spaces as seperators for next entry, instead it will consider new lines as seperators (files might have spaces in the name, so this is crucial for looping thru files – as we have to assume some files will have spaces).. Also since this is in a subshell I dont have to worry about setting IFS back to what it was originally (default IFS is this:IFS=$’ \t\n’  )

Multi line:

(
IFS=$'\n'
for package in `dpkg -l | grep mono | awk '{print $2}'`; do
echo "--- $package ----"
 for f in `dpkg -L $package`; do
   [[ -f "$f" ]] && ls -lisah "$f"
 done
done
)

One line (when converting to one line, put ; at the end of each line, just dont put it after the “do”s in the for loops – on the same topic also dont put ; after while loops):

(IFS=$’\n’; for package in `dpkg -l | grep mono | awk ‘{print $2}’`; do echo “— $package —-“; for f in `dpkg -L $package`; do [[ -f “$f” ]] && ls -lisah “$f”; done; done)

The end.

Leave a Reply

Your email address will not be published. Required fields are marked *