1find . -type f -mtime +150 -exec ls -lrt {} \; | more
2find . -maxdepth 1 -name "*.log" -mtime +10 -exec ls -lrt {} \;
3find . -mtime +150 -exec rm -f {} \;
The find loop is cheaper than a shell loop (for ...). You can make it even more efficient by batching the rm calls:
1find . -type f -print -exec rm -- "{}" + # note the "+" instead of the usual "\;"
1du -max . # list all the FS sub-directories (-x avoids filesystems other than the requested one, "." = search from where you are)
2du -sh * # show the total without listing the sub-directories (h = human readable)
3du -max . | sort -n | tail -30 # the 30 largest files/directories
4du -ks * | sort -n # size in kilobytes of all files and directories, where you are
5du -hsc * | sort -h # from smallest to largest
6ls -lrS # list files by size (in bytes) - note: ls -l does not give the true value contained in a directory
7du -ch /dir/ # size of the directories contained in /dir/ (with suffix) then the total
1perl -e 'truncate "wanted_file", 100000'
2truncate -s 0 /ftpusers/ftp.upload.log
1lsof +aL1 # "+L1" selects open files that have been "unlinked" (deleted but still open)
2lsof -nP | grep '(deleted)'
3find /proc/*/fd -type f -links 0 -exec ls -lrt {} \; # [SunOS]
There are two solutions:
1[root@cacti-server ~]# lsof | grep delete
2mysqld 5678 mysql 3w REG 104,17 14 97730 /var/lib/mysql/mysqld-slow.log (deleted)
The highlighted block above is the inode held by the process. You can then find the process (and its fd, cwd, exe, … descriptors) via /proc/<PID>, for example ls /proc/5678.