Obtaining app storage details via ADB
My first instinct to dig out such information which is often available via programming route  is to go through dumps of various system services. One such service is diskstats whose only purpose is to dump the status of the disk. Looking into the java code of DiskStatsService.java for various Android releases, I noticed that the information you are looking for is available since Android Oreo. Among other things, the dump shows all the package names, their package sizes, their app data size, and their cache sizes. That information is also dumped into the file /data/system/diskstats_cache.json but this file cannot be accessed without root access though.

The dump is pretty ugly so I wrote a bash script to show data neatly. Run this script in your Linux. 

Here's the script (and it does not require root access too):


#!/bin/bash

USRDIR="$HOME"
F_DISK_STATS="$USRDIR"/diskstats.txt
F_PKG_NAMES="$USRDIR"/package_names.txt
F_PKG_SIZE="$USRDIR"/app_pkg_sizes.txt
F_DAT_SIZE="$USRDIR"/app_data_sizes.txt
F_CACHE_SIZE="$USRDIR"/app_cache_sizes.txt

# ADVISE: do a check whether ADB is working fine or not
adb shell dumpsys diskstats > "$F_DISK_STATS"

# Separating data into relevant named files
sed -n '/Package Names:/p' "$F_DISK_STATS" | sed -e 's/,/\n/g' -e 's/"//g' -e 's/.*\[//g' -e 's/\].*//g' > "$F_PKG_NAMES"
sed -n '/App Sizes:/p' "$F_DISK_STATS" | sed -e 's/,/\n/g' -e 's/.*\[//g' -e 's/\].*//g' > "$F_PKG_SIZE"
sed -n '/App Data Sizes:/p' "$F_DISK_STATS" | sed -e 's/,/\n/g' -e 's/.*\[//g' -e 's/\].*//g' > "$F_DAT_SIZE"
sed -n '/Cache Sizes:/p' "$F_DISK_STATS" | sed -e 's/,/\n/g' -e 's/.*\[//g' -e 's/\].*//g' > "$F_CACHE_SIZE"

# Printing package names and their sizes 
ttl_apps=$(wc -l "$F_PKG_NAMES" | cut -d ' ' -f1)
count=1
while [ $count -le $ttl_apps ]; do 
    pkg=$(sed -n "${count}p" "$F_PKG_NAMES")
    pkg_size=$(sed -n "${count}p" "$F_PKG_SIZE") 
    dat_size=$(sed -n "${count}p" "$F_DAT_SIZE")
    csh_size=$(sed -n "${count}p" "$F_CACHE_SIZE")
    echo -e "Pkg Name: $pkg" 
    echo -e "\t Pkg_size=$pkg_size bytes" 
    echo -e "\t Data_size=$dat_size bytes" 
    echo -e "\t Cache_size=$csh_size bytes" 
    echo -e "\t Total_size=$(($pkg_size + $dat_size + $csh_size)) bytes\n"
    count=$(( $count + 1)); 
done
 

Output when tested on OnePlus 6 (Android 9):


Pkg Name: org.xbmc.kodi
     Pkg_size=144297984 bytes
     Data_size=55771136 bytes
     Cache_size=54341632 bytes
     Total_size=254410752 bytes

Pkg Name: rikka.appops
     Pkg_size=10330112 bytes
     Data_size=1740800 bytes
     Cache_size=163840 bytes
     Total_size=12234752 bytes

Pkg Name: com.a0soft.gphone.aSpotCat
     Pkg_size=16228352 bytes
     Data_size=1101824 bytes
     Cache_size=163840 bytes
     Total_size=17494016 bytes