A commandline utility to find files and directories.

learn more… | top users | synonyms (1)

10
votes
9answers
38k 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 archive....
22
votes
1answer
983 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 ... +
12
votes
1answer
29k 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. ...
2
votes
1answer
244 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 ...
10
votes
3answers
15k 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 ...
20
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
583 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 ...
6
votes
2answers
15k 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 ...
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 ...
5
votes
6answers
940 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?
0
votes
4answers
3k views

How to find a file whose size is less than 10 MB?

I need to find a file in my current directory whose size should be less than or equal to 10 MB. ls -lh gives me the file size of each file but not sure how to find the files whose size are less than ...
2
votes
2answers
202 views

How can I list only folders with no sub folders in given path?

Problem:I have given dir structure ├── kat11 │ ├── kat21 │ │ └── Dokument\ bez\ nazwy │ └── kat22 │ ├── kat31 │ │ └── Dokument\ bez\ nazwy │ └── kat32 │ └── ...
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 ...
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
54
votes
9answers
116k 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.
34
votes
3answers
14k 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 /Artist/Album/cover.(jpg|...
25
votes
6answers
55k 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
42k 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 ...
10
votes
4answers
31k 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
36k 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 >> ...
20
votes
1answer
521 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 ...
10
votes
3answers
8k 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
10k 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
596 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 ...
10
votes
5answers
1k 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
4k 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 ...
10
votes
3answers
11k 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
2k views

Searching for a filename without a certain string

So when you want to search for a file with a filename containing the string xyz from a directory to all depths, you write sudo find path -name '*xyz*' How do I find all files without the string xyz?...
6
votes
2answers
5k 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
6answers
10k views

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

Say there are files with names: batman.c debate.c cricketbat.c What command and how should I use it to list all these files by using the searchtag bat?
4
votes
2answers
396 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
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 media/...
3
votes
2answers
955 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 ...
2
votes
2answers
835 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?
2
votes
2answers
904 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
5answers
3k views

JPG batch compression & rename (find -exec, xargs, piping?)

this is my first post so I hope you'll be kind enough to forgive me if I make some formatting mistakes or else. This is one question I've had for quite some time and while looking for answers I have ...
1
vote
2answers
387 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
1answer
45 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
530 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
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 ...
0
votes
3answers
78 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 ...