A commandline utility to find files and directories.

learn more… | top users | synonyms (1)

22
votes
1answer
943 views

What is the difference between using '+' (plus) and ';' (semicolon) in -exec command?

I'm wondering to know that what difference is the between using + and ; at the end of -exec command when I use in find command? find .... -exec ... \; VS find .... -exec ... +
7
votes
8answers
34k views

Filenames with spaces breaking for loop, find command

I have a script which searches all files in multiple subfolders and archives to tar. My script is for FILE in `find . -type f -name '*.*'` do if [[ ! -f archive.tar ]]; then tar -cpf ...
11
votes
1answer
27k views

How can I use find command more efficiently?

I wanted to know, what is the best way to use the find command efficiently? I generally use, find [filename] [dir] which gives me a long list of file names none of them any way related to my search. ...
5
votes
2answers
12k views

“find: missing argument to `-exec'” when using “-exec rm -f {}\”

I run this command: ~/shell_temp$ find . -type f -name "IMAG1806.jpg" -exec rm -f {}\ i got output below: > IMAG1806.jpg Error: find: missing argument to `-exec' what is exact command for ...
22
votes
1answer
468 views

find vs. locate

There are the commands find and locate to search for files on the disk. I know that find recursively processes all needed subdirectories to search files and therefore is slow but up-to-date, whereas ...
5
votes
2answers
4k views

How can I search for files in Unity?

I'm trying to use the dash instead of gnome-do, but I can't find files. "Find files" only returns "Top Results". In gnome-do, I was able to set some often-used directories to index. For example, I ...
10
votes
3answers
14k views

How can I find the location of an icon of a launcher in use?

I have a launcher on my desktop and want to add another one manually with the same icon. When I go to the preferences of the existing launcher and click the icon, it doesn't take me to the folder ...
26
votes
2answers
6k views

Did I just delete everything with find -exec mv?

I tried to figure this out on my own. Here's the command I used in the terminal: find . -name "*.jpg" -exec mv {} pictures \; I did not create a directory named pictures first. What happened was a ...
19
votes
2answers
4k views

What does “{} \;” mean in a Linux command?

Sometimes I see the following command: find . -name  * -exec ls -a {} \; I was asked to execute this . What does {} \; means here?
15
votes
2answers
565 views

What's the missing argument to -exec?

I use the following command to clear a directory, of files and directories over 30 days old, and move them to an archive directory which I can delete after a few weeks if nobody asks for their files ...
8
votes
1answer
27k views

Find file or directory in whole directory structure

How can I find a file with a specific name in bash. I want to search through the whole system. I tried with find, but that only work through one level.
5
votes
6answers
870 views

How can I find files quicker than find or locate?

I have been using find command to find files on my 1 tb hard disk. it takes very long. then I used locate which proved to be faster with regular update using updatedb. But the limitation of locate is ...
4
votes
1answer
3k views

What is the difference between “find” and “locate” search methods in Catfish?

There seem to be two different methods of searching for files in Catfish What is the difference?
2
votes
1answer
179 views

How can I recursively copy files by file extension?

I would like to copy all files with a certain extension that are in sub directories to a different folder. I don't want to maintain the directory structure, I just want to copy all files found to a ...
1
vote
2answers
2k views

Using grep to find a string

I am trying to locate a file that (should) contains the string "1896.345", somewhere under /home/dir/. Any ideas of how I can do it? Thanks
1
vote
3answers
123 views

Accessing a folder that I can't “name” in the shell

I have a stubborn folder that someone must have created accidentally and that has persisted all this time. I can see it with: # find /var/www/html -maxdepth 1 -type d which gives me: /var/www/html ...
49
votes
7answers
105k views

Find number of files in folder and sub folders?

I want to find the total count of the number of files under a folder and all its sub folders.
33
votes
3answers
13k views

Find directories that DON'T contain a file

Yes, I'm sorting out my music. I've got everything arranged beautifully in the following mantra: /Artist/Album/Track - Artist - Title.ext and if one exists, the cover sits in ...
24
votes
6answers
52k views

Find the latest file by modified date

If I want to find the latest file (mtime) in a (big) directory containing subdirectories, how would I do it? Lots of posts I've found suggest some variation of ls -lt | head (amusingly, many suggest ...
20
votes
2answers
38k views

How to find location of installed library

Background: I'm trying to build my program but first I need to set up libraries in netbeans. My project is using GLU and therefore I installed libglu-dev. I didn't note location where the libraries ...
9
votes
4answers
26k views

Using locate to find a directory

I use locate all the time to find files that I know the name of, locate is very fast and I love that. For recently created files find is great, normally with recently created files I know where ...
10
votes
5answers
33k views

Find files in linux and exclude specific directories

I have a find looking like this: rm -f crush-all.js find . -type f \( -name "*.js" ! -name "*-min*" ! -name "*console*" \) | while read line do cat "$line" >> crush-all.js echo >> ...
10
votes
2answers
10k views

How can I move all files in subdirectories recursively to a single directory?

I am trying to collect all the files under the current directory and all the subdirectories to one directory. I am trying something like the following find -type f -exec mv {} collection/{} \; ...
10
votes
3answers
6k views

How to list files older than a day with “2015” in filename?

I want to list all the log files which do not belong to today and only the files that contain 2015 in their names. These are the commands I have tried: find . -name 2015 -mtime +1 -exec ls -ltrh ...
2
votes
1answer
9k views

Search for a string recursively whilst in current directory

I want to search all files recursively from the directory I am in for a particular string. I tried grep -r -i my_string and I tried it in a test folder with two tiny files but it wouldnt find the ...
1
vote
2answers
587 views

Creating a directory of recently created files

On a system I have, files are uploaded through a series of various mechanisms into one central "incoming" directory. Once a day those files are processed and they are moved off to where they need to ...
8
votes
5answers
967 views

How do you output the filename in find command while using -exec?

I use the following line to find all sub-directories of the PWD and run svnadmin verify on each directory (I already know that they're Subversion repositories) find ./* -maxdepth 0 -exec svnadmin ...
0
votes
3answers
121 views

What is wrong in follwing -exec command

I m getting error in follwing command cd /opt/lampp/htdocs/EspoCRM-2.5.2 && find data -type d -exec chmod 775 {} error: find: missing argument to `-exec'
0
votes
3answers
3k views

how or where will i find C:\Program Files(x86) in Ubuntu 13.04?

How or where will I find C:\Program Files(x86) in Ubuntu 13.04? I cannot find it. I need it as I have installed a game there and I need to uninstall it. I have already tried to post a similar question ...
8
votes
3answers
10k views

using grep with pipe and ampersand to filter errors from find

I am using cygwin to find a file on the cygdrive. However I need to suppress the permission denied messages (otherwise the results get hidden in the error messages). The following command works: ...
6
votes
2answers
4k views

Find and delete all files without extensions witin a folder and its subfolders

I have a folder without around 500 subdirectories. There is a lot of trash to be found in it and I want to clean it up. I have already deleted certain filetypes that I don't want, like images, with ...
5
votes
1answer
448 views

Finding all .cpp files in the users home directory

How we will find more accurately all .cpp files in the users home directory that were modified no more than 5 minutes ago?
4
votes
6answers
7k views

command to find files by searching only part of their names?

Say there are files with names: batman.c batwoman.c batgirl.c cricketbat.c What command and how should I use it to list all these files by using the searchtag bat?
4
votes
2answers
370 views

How to find executables

I know there is a find switch. but I want to know how to search a specific type of file . For example I need kind of terminal command witch search for only executable files
3
votes
2answers
625 views

locate command finds a file's path, but the file does not exist in that path [duplicate]

I have written: locate Origin90SR2DVD.iso And I received the path where that file is located: /home/david/Origin90SR2DVD.iso Then I have written: cd /home/david I have run: ls -lrth And ...
3
votes
2answers
3k views

How to use find when there are spaces in the directory names?

I need to find all .nfo files in my media directory so I can use sed to change some parts. The problem is my folders have spaces in the names. find /media/media1/HDTV -name \*.nfo -type f ...
2
votes
2answers
723 views

Find and execute multiple scripts in parallel

G'day, I have tried to solve this problem all morning but have not had success. I would like to search for certain scripts in a particular folder and execute them all in parallel. The scripts have ...
2
votes
2answers
790 views

Command “find -name” must be enclosed in quotes or it doesn't work. Why is that?

find . -name *.rb doesn't work on my ubuntu I have to do find . -name "*.rb" to get it to work. Why is that?
1
vote
1answer
42 views

Edit find command to exclude a file

So I made this script Convert videos recursively with handbrake. And it uses this command as an option find . -name '*.mkv' -exec rm -r {} \; But i made this new script, for removing audio streams ...
1
vote
1answer
415 views

Can a directory's mtime be older than that of file inside?

I have this very silly and very basic question but I thought better to ask before I start pruning my NAS. I want to delete all directories in which all files are older than 30 days. For files I ...
1
vote
2answers
324 views

How to use 'grep' with characters like * and _?

I need to find some text in one or more files. This is what I use: grep -irI "hello" ~/ However, if I want to find a string containing characters like * or _ then these seem to be ignored. Let's ...
1
vote
3answers
8k views

Character encoding problem with filenames - find broken filenames

I have the problem described in this Q&A. Probably from quite old linux distros or from windows I have several files with broken filenames. ls displays a "?" instead of the broken character. I ...
1
vote
3answers
413 views

How can I recover data deleted using find -delete?

HI Guys! I am working on Ubuntu 10.04 version. I accidentally deleted my code from find -delete command. Is there any way to recover the data? Many thanks in advance.
0
votes
3answers
75 views

Zip files into weekly archive with week number

I am trying to take a weekly archive of a folder to separate zip files. find . -name '*.txt' -ctime +7 -exec zip "archive-$("date+%Y-%U").zip" {} \; I am stuck on how to name the zip file. Any ...