![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| No space on /dev/hd 1/42 | ibqti | SCO | 1 | 11-09-2007 02:53 PM |
| swap space / paging space | aaronh | AIX | 2 | 05-19-2004 07:06 AM |
| how much space? | pgas | UNIX for Dummies Questions & Answers | 1 | 04-06-2004 08:03 AM |
| pageing space vs swap space | VeroL | UNIX for Dummies Questions & Answers | 1 | 01-22-2004 08:54 AM |
| More space | grep | UNIX for Dummies Questions & Answers | 2 | 12-02-2002 12:08 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
space hog
How can I find the hog AND list files edited in the past day?
I have used du -ks *|sort -nr|pg --to find hog listed in kilobytes I know find ./ -mtime +1 -- will find files modified in the past day. How can I combine them or what would be a better way? The reason for this is that I had a dir getting full and within that directory it was pretty even accross 10 directories as to the highest Mb amount. Wanted to narrow down where to look for any log files or the culprit that most recently grew too large. -Thanks |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Maybe this will help:
Find Command |
|
#3
|
||||
|
||||
|
Thanks for the link but I still am having the problem......not able to find the hog AND list files edited in the past day?
|
|
#4
|
||||
|
||||
|
I'm still not totally sure how you want the formatting of the final report.
Also, you need -mtime -1 in order to show files modified in the last 24 hours (i.e. a day ago or less). A basic idea would be something like.... Code:
#!/bin/sh
du -ks * | sort -nr | while read size hog
do
# Display size of dir/file
echo "Current Hog - $hog ($size):"
# Show listing of files modified a day ago or less
find $hog -mtime -1 -exec ls -l {} \;
done
Cheers ZB |
|
#5
|
|||
|
|||
|
Can u explain:
find $hog -mtime -1 -exec ls -l {} \; I transfered a large file just before executing script so it could be considered a growing hog within 1 day as a test (Al.v1.4.3.410.Retail.rar) Here is my output: $ du -ks *|sort -nr|pg 217208 bac.tar 130664 16.1.0.30.tar 86583 ciagent_sms 3280 Al.v1.4.3.410.Retail.rar 3 test 2 house 1 test2.txt.gz 1 test2.txt 1 test1.txt 1 test.sh 1 test.csv 1 script.sh 1 private 1 one 1 hog1 1 hog.sh 1 files.tar.Z 1 dir_link 1 dead.letter 1 date.txt 1 csv_link 0 perm $ $ HERE IT YOUR SCRIPT: $ hog.sh Current Hog - bac.tar (217208): Current Hog - 16.1.0.30.tar (130664): Current Hog - ciagent_sms (86583): Current Hog - Al.v1.4.3.410.Retail.rar (3280): -rw-r--r-- 1 joek staff 3344362 Jan 27 15:34 Alcohol.120%.v1.4.3.410.Retail.rar Current Hog - test (3): Current Hog - house (2): Current Hog - test2.txt.gz (1): Current Hog - test2.txt (1): Current Hog - test1.txt (1): Current Hog - test.sh (1): Current Hog - test.csv (1): Current Hog - script.sh (1): Current Hog - private (1): Current Hog - one (1): Current Hog - hog1 (1): -rw-r--r-- 1 joek staff 234 Jan 27 15:25 hog1 Current Hog - hog.sh (1): -rwxrwxrwx 1 joek staff 224 Jan 27 15:48 hog.sh Current Hog - files.tar.Z (1): Current Hog - dir_link (1): Current Hog - dead.letter (1): -rw------- 1 joek staff 301 Jan 27 11:13 dead.letter Current Hog - date.txt (1): Current Hog - csv_link (1): Current Hog - perm (0): It looks like it works, but I would like to understand how? How does the last line work? (find $hog -mtime -1 -exec ls -l {} \ Also, when it searches for the hog for the past day could I format the output using - awk '{print $5,$NF,$6}' so it only displays column 5,6 and the last column of the "ls -l" command (size,filename, date). I tried to insert that instead of the -exec comand with no luck. -Thanks |
|
#6
|
||||
|
||||
|
I did some thing like this ...
Code:
find $hog -mtime -1 | xargs ls -l | xargs | tr -s " " | awk ' { print $5,$NF,$6 } '
|
||||
| Google The UNIX and Linux Forums |