Size of folder tree | du -h .| sort -nr |
Size of current folder (level 1) | du -d 1| sort -nr |
Quotas | quota -v |
Delete files and folders in current folder older than 90 days#
find . -type d -mtime +90 -exec rm -rf {} \;
Size of Folder#
Print current folder in kb (includes org space? it is not the sum of ls)du -sk . ls -l | awk '{t+=$5}END{print t}' ls -lR . | awk '{sum += $5} END{print sum}'
exactly the sum of ls in MB
ls -lR . | awk '{sum += $5} END{printf "%2f\n", sum/1024/1024}' ls -al | sort -nbk5 => sort by file size ls -lrt => sort by date/time
Get sizes of folders and subfolders
du -h --max-depth=3 or a shell script: #/bin/sh du -k --max-depth=1 | sort -nr | awk ' BEGIN { split("KB,MB,GB,TB", Units, ","); } { u = 1; while ($1 >= 1024) { $1 = $1 / 1024; u += 1 } $1 = sprintf("%.1f %s", $1, Units[u]); print $0; } '
Get all files on specific dates#
find . -mtime -60 (last 60 days) find . -maxdepth 1 -mtime -1 -ls (last 1 day) find . -maxdepth 1 -mtime -0.007 -ls (last 10 minutes)
Get all files for a date range and copy/move those#
find -type f -newermt 20141101 \! -newermt 20141218 mv -t <destination> `find -type f -newermt 20141101 \! -newermt 20141218`
Sort by time
ls -t ls -tr
Pipes, see here
Append >> | cat $DATEIM >> $DATEIJ |
Targeting > | cat $DATEIM > $DATEIJ |