Questions tagged [find]

A commandline utility to find files and directories.

A command-line program to find files and directories, filtered by a bunch of conditions, which can be further processed with multiple options, available on unixoid systems and, as a gnu-tool, for win32.

Ubuntu has a Community Wiki page that serves as a great introduction to the use of this admittedly complex utility:

Ubuntu Community Wiki - find

665 questions
38
votes
1 answer

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 ... +
αғsнιη
  • 35,660
36
votes
2 answers

Sort files alphabetically before processing

I use the command find . -type f -exec sha256sum {} \; > sha256SumOutput to hash every file in a folder hierarchy. Unfortunately, sha256sum doesn't get the file names from find in alphabetical oder. How can this be fixed? I'd like to have them…
UTF-8
  • 5,710
  • 10
  • 31
  • 67
22
votes
4 answers

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 basically they were created so I don't have to search…
Michael
  • 323
20
votes
5 answers

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 >> crush-all.js done I'd like to add to exclude a directory…
Asken
  • 543
  • 3
  • 5
  • 16
20
votes
1 answer

What does "paths must precede expression" mean when using find?

I want show all the files that have a .bak extension. kaykav@ubu2:~/Documents$ ls cdIndex1-60 met.bak tem.bak I type the cmd : $ find . -name *.bak I'm in the correct Directory for this. I get the following message: find: paths must precede…
kaykav
  • 201
13
votes
2 answers

how to have 'find' not return the current directory

I'm currently trying to find (and copy) all files and folder structure matching a specific pattern, in a specified directory and I'm so nearly there! Specifically, I want to recursively copy all folders not begining with a '_' character from a…
Pinpin
  • 165
11
votes
2 answers

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 which search for only executable files.
Mohammad Reza Rezwani
  • 10,286
  • 36
  • 92
  • 128
10
votes
4 answers

How to use find quietly?

I want to search for all occurences of on my machine. Now when I perform a search like this find / I can see all the paths the search is running through. How can I limit the results to my searchterm? Abstract example I…
dialogik
  • 273
9
votes
5 answers

Find executable filenames without path

I have a folder with many executables, and I want to omit the path in the results of the find command. this command shows the files I want to see, but it also lists the path; I just want the file name. find /opt/g09 -maxdepth 1 -executable how can…
j0h
  • 14,825
6
votes
3 answers

How do I check the prometheus version?

I'm running two servers with Ubuntu and one of them has grafana and prometheus running on it. I'm trying to rebuild the same environment on the other server however I fail to find the version of it. Searching with find / prometheus* also didn't have…
4
votes
3 answers

Using find and stat to display filename(s) and statistics

I'm trying to run a command to find all files starting with 'geo' and see when they were edited. I am trying to following but unfortunately am having no luck.. Is there a param for stat to display the filename or do I need a multi-line bash…
Menelaos
  • 141
  • 1
  • 1
  • 5
4
votes
1 answer

Can't find files older than 1 day

I want to find all files beginning by backup* older that 1 day in a folder. I do: find /home/mypc/backup* -mtime +1 But I am getting an empty list. Where am I wrong?
thomas
  • 383
4
votes
1 answer

How to restrict the "find" command to a physical drive?

Often I go looking for something and resort to running find / -name ... But when there are multiple network drives mounted it can take forever. There doesn't appear to be any parameter to restrict it to a physical disc/volume. Is there any way to…
John Mee
  • 953
  • 1
  • 8
  • 18
3
votes
1 answer

Using find with the -size test

I originally asked this question in the Ubuntu Forums, and I thought I understood it, but then I saw somebody use the same command in a different way, and now I'm not sure if I understand it anymore, so I'm humbly asking for your help again. This is…
3
votes
1 answer

Using the find command with the -cnewer test

I'm trying to understand the output of the find command with the -cnewer test. In doing some limited testing, this is what I get. First, I created a file: cd ~/Documents touch file1.txt Then I waited a few minutes before creating another…
1
2 3 4