Questions tagged [gnu-findutils]

GNU's basic directory searching utilities (Unix filesystem CLIs)

The GNU Findutils package comprises the following CLIs, which relate to finding directories and files on Unix systems:

  • find - search for files in a directory hierarchy
  • locate - list files in databases that match a pattern
  • updatedb - update a file name database
  • xargs - build and execute command lines from standard input

Linux distributions typically come with find and xargs from this package; while locate and updatedb are typically also present, they may come from a different source.

See http://www.gnu.org/software/findutils/

82 questions
79
votes
8 answers

How to find files modified in last x minutes (find -mmin does not work as expected)

I'm trying to find files modified in last x minutes, for example in the last hour. Many forums and tutorials on the net suggest to use the find command with the -mmin option, like this: find . -mmin -60 |xargs ls -l However, this command did not…
hashbang
  • 899
  • 1
  • 6
  • 4
21
votes
1 answer

find file by size more MIN and less MAX

how i can use linux find command for search files that more MIN and less MAX I tried to use the following command: find . -type f -a -size +1000 -a -size -1100 but it does not work
Ivan Ivanovich
  • 880
  • 1
  • 6
  • 15
10
votes
2 answers

How to use GNU parallel with find -exec?

I want to unzip multiple files, Using this answer, I found the following command. find -name '*.zip' -exec sh -c 'unzip -d "${1%.*}" "$1"' _ {} \; How do I use GNU Parallel with the above command to unzip multiple files? Edit 1: As per questions by…
Tarun Maganti
  • 3,076
  • 2
  • 35
  • 64
9
votes
1 answer

In homebrew, how can I know xargs belongs to the findutil package?

I'm on a mac and I don't want to use the builtin xargs utility. Because it's different with the gnu xargs. After google around I found xargs belongs to the findutils package in homebrew and I can install it with a simple command brew install…
Just a learner
  • 26,690
  • 50
  • 155
  • 234
7
votes
4 answers

How to delete all subdirectories with a specific name

I'm working on Linux and there is a folder, which contains lots of sub directories. I need to delete all of sub directories which have a same name. For example, dir |---subdir1 |---subdir2 | |-----subdir1 |---file I want to delete all of…
Yves
  • 11,597
  • 17
  • 83
  • 180
7
votes
5 answers

Finding Files in a Git Bash Terminal

I am currently using Git Bash to navigate file directories and edit files. I want to know if there's a command to search the current directory and all directories in it for a file name.
user2679671
6
votes
3 answers

Unix find -mtime {a negative or postive value}

What do find -mtime -4 and find -mtime +4 do? I cannot understand the examples given in the man page.
Unixbun
  • 63
  • 1
  • 3
5
votes
2 answers

Stop recursion of find command if match found

Using GNU findutils, I need to search a directory tree for a certain file. If the file has been found for a given branch, I want to prevent find from recursing further into the branch. Say I want to find the file foo, and this is my directory…
Eric Lilja
  • 3,323
  • 4
  • 18
  • 15
5
votes
3 answers

GNU find: when does the default action apply?

The man page of Debian 8's find command says: If the whole expression contains no actions other than -prune or -print, -print is performed on all files for which the whole expression is true. So why do these outputs differ: $ mkdir -p test/foo…
artfulrobot
  • 20,637
  • 11
  • 55
  • 81
4
votes
2 answers

Find command not working with -mtime and -daystart parameter in linux-bash

I am trying to find the files which are created 10 mins ago and with the -daystart parameter (i.e created/modified more than 10 mins but less than daystart) in find command, but -mmin is taking the priority and -daystart is ignored. Any suggestions…
4
votes
1 answer

How to find files containing newlines in their names

There is so much told about correct handling of file names which contain weird symbols like newlines. I thought using IFS set to newline would solve the issue in general except obviously for the case if one has a name with newline in it. So as a…
3
votes
2 answers

Find file recursively excluding subfolders with specific substring

I need to get all paths which has a specific file: find apps -type f -name "project.json" This returns something like apps/sub/frontend-e2e/project.json apps/sub/frontend/project.json apps/sub/backend/project.json But I want to exclude all paths…
user3142695
  • 15,844
  • 47
  • 176
  • 332
3
votes
1 answer

Find command works in terminal but not in bash script

I wrote a find command, which finds the files, but excludes other files/directories. I did echo this code and copied it. If I paste it in the terminal, it works. Some files were excluded. But if I execute it from the script, it does not work as…
FFBbodie
  • 111
  • 2
  • 12
3
votes
3 answers

Use find to get all folders that don't have a .git subfolder

How to use find to get all folders that have not a .git folder? On this structure:: $ tree -a -d -L 2 . ├── a │ └── .git ├── b │ ├── b1 │ └── b2 ├── c └── d └── .git ├── lkdj └── qsdqdf This:: $ find . -name ".git" -prune…
user3313834
  • 7,327
  • 12
  • 56
  • 99
3
votes
1 answer

removing path prefix from find results

At the simplest, if I execute find . -type f -exec cp {} /new/path/{} The path that is expanded is /new/path/./path/to/file. I would like to remove that ./ that is prefixed by the find command before I use {} in the exec. I am using the builtin…
lbutlr
  • 414
  • 6
  • 18
1
2 3 4 5 6