Removing only my files in Unix

find . -user myuser -print0 |xargs -0 rm

Put your own userid (or maybe user number) in for "myuser".


rm doesn't read from stdin.

find -user $(whoami) -delete

Please always test without the delete first.


You were really close. Try:

rm `ls -la | grep 'myid' | awk ' { print $9 } '`

Note that those are backticks, not single quotes surrounding the first three segments from your original pipeline. Also for me the filename column was $8, but if $9 is the right column for you, then that should do it.

Tags:

Unix