from itertools import islice, groupby; from pathlib import Path
format="{:<30}{:<10}"
for ftype, items in groupby(sorted(Path('/proc').iterdir(), key=lambda x: (x.lstat().st_mode, str(x))), key=lambda x: x.lstat().st_mode): [print(i) for i in ([format.format("path", "type")] + [format.format(str(path), ftype) for path in (islice(items, 0, 10))] + [f"(another {len(list(items))+1})\n" if next(items, False) else ""])] and None