-
Notifications
You must be signed in to change notification settings - Fork 5
Home
gfxmonk edited this page Dec 18, 2014
·
11 revisions
ls -1 / | piep 'root=set(pp) | pp = sh("mount").splitlines() \
| p.split() | p[2] | p[1:] | "/" not in p | bool \
| root.difference(set(pp)) | "/"+p \
| sh("du","-hs", *pp, stderr=open(os.devnull), stdout=sys.stdout)'
Explanation:
-
root=set(pp)
: convert input (ls -1 /
) into into a set, for later -
| pp = sh("mount").splitlines()
: runmount
, and save its lines as the newpp
-
| p.split() | p[2] | p[1:] | "/" not in p
: grab the path component, trim off the leading slash and remove any paths that have more than one slash -
| bool
: filter out the empty result -
| root.difference(set(pp))
: setpp
to the difference of the storedroot
variable and the currentpp
value -
| "/"+p
: add back leading slash -
| sh("du","-hs", *pp, stderr=open(os.devnull), stdout=sys.stdout)
: rundu -hs
on all paths. Print directly to stdout, and ignore stderr