How to list files owned by me for quota checking?

Solution 1:

Using find, you should use a way that is safe regarding spaces and other funny symbols that can appear in filenames. This should do (provided your find and du versions accept the options):

find . -type f -user "$USER" -print0 | du -ch --files0-from=-

(the -c option is to have a nice total at the end). This will not count the size of the directories though.

If in the directory tree you have some directories that are not accessible by you, you might get some junk (permission denied) on your screen, so you might want to redirect stderr to /dev/null as:

find . -type f -user "$USER" -print0 2>/dev/null | du -ch --files0-from=-

Solution 2:

I would probably just do a find command based on username, I assume that is what they calculate the quota off.

Something like:

#!/bin/bash

for i in `find . -type f -user $(whoami)`; do
    du -h ${i}
done

That will list all files owned by $(whoami) with the file size in human readable format.

Though, that list is really long on my system, so I would probably suggest stdout to a file on that (> output.txt, for example) or adding -maxdepth # in the find command to limit it to a manageable level of directories.