Prev | Current Page 393 | Next

Christopher Negus

"Linux Bible, 2008 Edition: Boot up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 11 Other Distributions"

If you are not the root user, there will be many places in the file
system that you will not have permission to check. Regular users can usually check their own home
directories but not those of others.
In the following example, the find command searches the root file system (/) for any files owned
by the user named jake (-user jake) and prints the filenames. The output of the find command
is organized in a long listing in size order (ls -ldS). Finally, that output is sent to the file
/tmp/jake. When you view the file /tmp/jake (for example, less /tmp/jake), you will find
all of the files that are owned by the user jake listed in size order. Here is the command line:
# find / -xdev -user jake -print | xargs ls -ldS > /tmp/jake
The -xdev option prevents file systems other than the selected file system from being
searched. This is a good way to cut out a lot of junk that may be output from the /proc
file system. It can also keep large remotely mounted file systems from being searched.
Here??™s another example, except that instead of looking for a user??™s files, we??™re looking for files larger
than 100 kilobytes (-size +100k):
# find / -xdev -size +100k -print | xargs ls -ldS > /tmp/size
You can save yourself a lot of disk space by just removing some of the largest files that are no
longer needed.


Pages:
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405