Sometimes you know what your looking for but more often than not, you need to find some file based off of size and creation/saved/modified date on your Ubuntu server. Here's the command you need to find it and then print the results to a useful [any] file type you need to sort the data.
Command (by size more than 1MB):
find / -type f -size +1048576 -printf "%s:%h%f\n" > largerthan1mb.txt
Lets break it down:
-
find = locate something
-
/ = your desired directory
-
f = file
-
-size = what should the minimum size be
-
+1048576 = greater than 1MB; just enter your desired size here
-
-print = show something on screen
-
"%s:%h%f\n" = display size, name, folder, line break
-
> = put the results somewhere in some sort of file
-
largerthan1gb.txt = your new filename and type
-
/ = this command will leave the .txt file in the root folder location as specified as above aka /root/largerthan1gb.txt
-
This command is especially helpful if you're searching multiple mystery files; export as .csv and use LibreOffice's import tool to sort the data into useful columns.
Command (by specific date):
find / -newermt 2015-12-28 ! -newermt 2015-12-29 -ls > dec28.csv
Lets break it down:
-
find = locate something
-
/ = your desired directory
-
-newermt = start on some date
-
2015-12-28 = your desired start date
-
-newermt = stop on some date
-
2015-12-29 = your desired stop date
-
-ls = list a bunch of stuff
-
> = put the results somewhere in some sort of file
-
dec28.csv = your new filename and type
-
/ = this command will leave the .csv file in the root folder location as specificed as above aka /root/dec28.csv
-
If you need help finding a lost file or suspect something nasty has been placed on your [web]server but can't quite find it, contact us; we love to help. Happy searching!
Comments powered by CComment