An overview of the find command
Let us see how to use find command to gain lots of useful information about users and their files.
Posts tagged ‘find’
Let us see how to use find command to gain lots of useful information about users and their files.
While the Linux find command has a number of uses, the most obvious being looking for files matching full or partial names, the one often underused option is to use it to locate old files. To show all files in a directory older than 14 days:
find /var/crap_files/* -mtime +14 -print
An even more powerful option is to use the -exec switch which allows you to delete old files. To delete all files in /var/crap_files/ older than 7 days:
find /var/crap_files/* -mtime +14 -exec /bin/rm -rf {} \; 2>/dev/null 1>&2
It’s quite often I have directories full of media files (specifically music) and subdirectories within them also with music files, and though the manual for MPlayer is thicker than the Chinese phonebook I have not been able to find any option for it.
I did however find a method which isn’t exactly the guru one-liner, but here it is anyway. It’s broken into two steps, the first to create a playlist:
find -maxdepth 1 -type f -name \*.\* > playlist
Then finally play the playlist:
mplayer -playlist playlist
Just add a -loop 0 suffix if you want to loop
When I moved to Opera full-time as my browser of choice the feature I missed the most was Firefox’s Find As You Type. This allowed you to find text on the current page simply by typing it in and without having to call up a clunky Find box. While it was rather hit and miss, it is a great feature.
Continue reading ‘Opera Find on Page, nearly Find As You Type from Firefox’ »
To find all files that was modified since a specific time ago (i.e an hour ago, a day ago, 24 hours ago, a weeks ago and so on) in Unix environment, the find command will come in handy.
Continue reading ‘Find files modified at a certain time’ »
let us see how to use find command
(a) To gain lots of useful information about users and their files
(b) Monitor and enhance the security of system using find command
Continue reading ‘Finding and locating files with find command’ »
Use this simple command to find large directories. To find directories over 1GB
[root@localhost]# du -h / | grep ^[0-9\.]*G
G can be replaced with M if looking for MB instead.
To find directories over 10GB and sort the output with the largest directories on top
[root@localhost]# du -h / | grep ^[1-9][0-9][0-9\.]*G | sort -rn
Continue reading ‘Finding large files and directories on Linux’ »
First off lets check to see if findutils and findutils-locate are installed. You can check by performing a:
rpm -qa | grep findutil (in Ubuntu/Debian you can check synaptic to see if they’re installed).
It should produce results such as this:
# rpm -qa | grep findutils
findutils-4.2.31-24
findutils-locate-4.2.31-24