search for files in a directory hierarchy

learn more… | top users | synonyms

23
votes
8answers
52k views

how to find out mac addresses of all machines on network

Is there some easy way to find out mac address of all machines on my network rather than doing an SSH into each and ifconfig | grep HWaddr if there are 300 machines on network I really need some easy ...
16
votes
2answers
2k views

How to find files in a Debian system not installed or created by dpkg?

I've installed some things manually in the past and would like to weed out all related files. So, I need a way to automatically find all the files (in /usr, for example) that are not included in any ...
15
votes
5answers
25k views

How do I find (or exclude) all directories and sub-directories matching a certain pattern (in Linux)?

I'm trying to use the Linux find command to find all directories and sub-directories that do not have .svn (Subversion hidden folders) in their path. I can only get it to exclude the actual .svn ...
14
votes
4answers
10k views

Shell Scripting: Using find to delete files matching a pattern

I'm trying to write a bash command that will delete all files matching a specific pattern - in this case, it's all of the old vmware log files that have built up. I've tried this command: find . ...
14
votes
4answers
9k views

Bash find command verbose output

Good time of the day, Is there way to tell the bash "find" command to output what it is doing (verbose mode) ? For example for the command: find /media/1Tb/videos -maxdepth 1 -type d -mtime +7 -exec ...
13
votes
3answers
3k views

A better unix find with parallel processing?

The unix find(1) utility is very useful allowing me to perform an action on many files that match certain specifications, e.g. find /dump -type f -name '*.xml' -exec java -jar ProcessFile.jar {} \; ...
11
votes
9answers
5k views

How do I master the UNIX find command?

I think I am fairly advanced in my use of find but EVERY time I use it I cannot for the life of me remember the method to close the -exec option. I spend a good deal of time reading every time I use ...
10
votes
7answers
18k views

Linux: using find to locate files older than <date>

find has good support for finding files the more modified less than X days ago, but how can I use find to locate all files modified after a certain date? I can't find anything in the find man page to ...
9
votes
3answers
180 views

Find's -true option: what for?

GNU find (and others?) has a -true test along with the normal -name, -mode, -user and so on. From the man page: -true Always true. Every time I see the man page I notice this and wonder when ...
8
votes
3answers
4k views

Unix magic, delete all .pyc files from a tree of directories?

Is there a quick way of deleting all the .pyc files from a tree of directories?
8
votes
2answers
3k views

Linux & SVN: How to remove all versioned files but KEEP directory structure, ignore .svn dirs?

I want to remove all the versioned files from my repository, but KEEP the versioned directory structure. Obviously I want to leave all the .svn directories untouched. In other words, I want to ...
8
votes
2answers
9k views

Postfix “warning: cannot get RSA private key from file”

I just followed this tutorial to set up a postfix mailserver with dovecot and mysql as backend for virtual users. Now I got the most parts working, I can connect to pop3 pop3s imap and imaps. Using ...
8
votes
2answers
4k views

find command default sorting order

what is the default sorting order for entries returned by the linux find command? For example, if I issue find . -type f -name '*mp3' and the output consists of multiple files across multiple ...
7
votes
5answers
3k views

Linux find command - show progress

I was wondering if there's any way to display some kind of progress info when searching for files in linux using find. I often find myself searching for files on a big disk and some kind of progress ...
7
votes
4answers
1k views

Bash: execute command on results of FIND

I am trying to resize all files that are found using a FIND command (they are all files within a directory and its subdirectories). I tried many options but stumble across different errors each time. ...
7
votes
3answers
9k views

how to find files with incorrect permissions on unix?

I'm looking for a way to search a directory or directories and list all the files that have the wrong permissions for a public directory.
6
votes
6answers
8k views

How to Find a file in FreeBSD

I'm trying to locate all copies of example.filename on my FreeBSD server. What's the best / easiest / most efficient way to do this?
6
votes
3answers
2k views

Non-recursive find on linux

I am trying to find all directories that are directly inside the current directory and older than a specific age. The trick is, I only want to consider the age of the immediate descendants of the ...
6
votes
3answers
364 views

Using `find` to delete

So, given three options... find .... -delete find .... | xargs rm ... find .... -exec rm ...; ..or variations thereof, which option is preferable? I'm guessing there is no hard and fast ...
6
votes
6answers
9k views

How do I find all files and directories writable by a specific user?

Under Linux, how can I find all the files and directories that are writable (or, actually, not writable) by a particular user? Edit: To clarify, I meant under a particular subdir, not systemwide. ...
5
votes
4answers
2k views

find only files in directory with permissions not set to 644 on linux

This is my first question although I've been lurking for a while. Question: I would like to use find to get only the files in a directory with permissions not set to 644 (or another permission ...
5
votes
3answers
5k views

How can I handle spaces in file names when using xargs on find results?

One of my common practices is to perform greps on all files of a certain type, e.g., find all the HTML files that have the word "rumpus" in them. To do it, I use find /path/to -name "*.html" | xargs ...
5
votes
5answers
272 views

How to find all filenames with given extension

I need to find all .pem files on my system. Would the following do this? sudo find / -type f -name *.pem If not, how would I write a find command to find every file of the sort?
5
votes
1answer
5k views

Get all extensions and their respective file count in a directory

Getting all extensions for a directory: easy. Getting file counts for a particular extension: easy. But getting all file extensions and their respective file counts is alluding me. eg. + dir + ...
5
votes
7answers
2k views

Linux Colorize Find?

Is it possible to 'colorize' the output from find? I have a find that searches /home on all of my servers, and exec 'rm' certain files. As these are mixed in with my other find results, among ...
5
votes
2answers
240 views

Does “find” open files?

I recently issued this command: find . -type f | wc -l To count how many files are in my public_html folder. Shortly after, Nginx returned 500 internal server error and error.log was being flooded ...
5
votes
2answers
6k views

How to count all subfolders in an directory?

How can I count how many folders (including subfolders) I have under an specific folder?
5
votes
1answer
5k views

How do I find circular symbolic links?

I'm working on a HP-UX system and I want to find if there are any circular symbolic links. So far I'm using the command: ls -lrt `find ./ -follow -type l` But it's only doing ls -lrt on current ...
5
votes
2answers
2k views

FreeBSD: How to know real file size on zfs with compression on?

I'm using zfs on my FreeBSD 9.0 x64 and pretty happy with it, but I find it hard to count directory real, not compressed, size. Surely I can walk over the directory and count every file size with ...
5
votes
4answers
2k views

How to tell if a file is older than 30 minutes on AIX?

I'd like to write a shell script in ksh or bash which exits with 1 if a specific file is older than 30 minutes. (Last modification time is older than half hour). It would be easy on a Linux or a ...
5
votes
2answers
946 views

List directories not containing a file

I've seen similar questions to this, but nothing I can find related directly to files. Is there any way to give me a list of directories which do not contain a specific file? Example: /dir1/good ...
4
votes
4answers
10k views

“find -mtime” does not work as expected on files with different timezones?

I have some files on server with the date several months ago, but invisible for find -mtime 7 search. When I list them as ls -l they look perfectly normal -rw-r--r-- 1 root root 347253 Jun 12 ...
4
votes
2answers
3k views

Why does this regex not work on linux?

prescript: I am not sure where this question belongs i cant say it works on windows but from my understanding this regex is correct and how i would write it (except maybe the ^ at the beginning) ...
4
votes
5answers
215 views

Get Size of All Folders in Directory

I want to get the size of all directories within a specific directory. I was thinking something like find . -type d -exec du -sh {} \; But that returns all directories recursively. How can I limit ...
4
votes
1answer
12k views

How to view hidden files using Linux `find` command

On a Linux server, I need to find all files with a certain file extension in the current directory and all sub-directories. Previously, I have always using the following command: find . -type f | ...
4
votes
4answers
6k views

Locate, Find, Which - How do I launch an index/scan command for these utilities?

How do I re-scan my drive so my 'search utilities' are able to find a new file on my system? I'm having a tough time googling HOW TOs for launching an index/scan command to any of this applications. ...
4
votes
1answer
212 views

Linux command to find all *.rb files

I still can't figure out how to use the Linux find command. I'm trying to find all the .rb files under the /var/www directory. What's the correct command to type in Bash?
4
votes
3answers
4k views

finding a file which was modified in last 10 minutes

I am running this command to find out the files which were modified in last 10 minutes find / -fstype local -mtime -10m but it is giving following error each time find: missing argument to ...
4
votes
2answers
13k views

Move files to another directory which are older than a date

I am looking for a solution to move files that are year older from today. My log partition is getting full, but I can not remove them. They are needed for a long long time. Anyway one solution I came ...
4
votes
2answers
334 views

Difficult to Delete Files in Linux

There's a lot of stuff about this on the Internet, but most of the examples there are contrived. How does one delete files that are really stubborn? e.g., $ find ./ -inum 167794 ./àKÈÿÿÿÿ@ $ find ...
4
votes
2answers
818 views

How do i use the {} operator in find execution inside exec

I tried this bash command: find /var/www/ -path '*wp-admin/index.php' -exec mv {} $(dirname {})/index_disabled But the second {} is not executed. It results in just ./index_disabled instead. How ...
4
votes
1answer
52 views

Glob Not Match?

How to list files that don't match a glob? E.g., let's say I have a directory that contains hundreds of files, 97% of which have the filename extension .png. I know I can list the PNG files with: ...
4
votes
1answer
78 views

Look on all server desktops for outstanding files before deleting profiles

We have about 70 servers that we are in the process of moving into a domain environment, so we are converting our users from local accounts to domain controlled accounts. How can we determine which ...
3
votes
4answers
1k views

How to do a for loop of filenames with spaces using find

I have the following script - its supposed to loop files names using find but it seams to break the files names up by a space? I need the file names to remain intact #!/bin/bash for file in `find ...
3
votes
3answers
3k views

Linux - A more fine grained -mtime for find?

find is a great tool for finding files. It has the option to find files that were modified in the last X days with -mtime. However I'd like something more fine grained than that. I want to be able to ...
3
votes
2answers
285 views

What does rm {} + do?

As in find -L /etc/ssl/certs/ -type l -exec rm {} + So it finds all broken symlinks and deletes them. But how exactly do I interpret the {} + part?
3
votes
2answers
916 views

how to list files that are NOT open using find command

I want to "list" all the files that are NOT open, within a certain directory using the GNU find command. Now, I am able to list the files that are open, but can't figure out a way to do the inverse of ...
3
votes
2answers
444 views

find all directories having less than x files inside

Assume starting at some directory in the filesystem. This base directory has lots of subdirectories (not nested!). Each of the subdirectories has an arbitrary number of files withing. How can I find ...
3
votes
3answers
5k views

Why does FIND on Windows 7 give an “Access Denied” error?

I have an administrator account on a Windows 7 x64 machine. It is not THE administrator account, the account is simply a member of the administrators group. The install is default. When the user ...
3
votes
5answers
4k views

find command + enable Exit status to be diff then 0 when not match

when I perform find /tmp -name something find command not find the something word under /tmp echo $? I get $?=0 it's OK but how to enable Exit status diff then 0 when find command not ...