Linked Questions
19 questions linked to/from Problem running find: missing argument to `-exec'
7
votes
2
answers
10k
views
missing argument to find -exec [duplicate]
I want to remove certain files using find and -exec. But unlikely bash tells me, that I'm "missing" some argument.
find . -name *.png -exec rm {} /;
what do I miss?
same "missing argument" return ...
0
votes
2
answers
4k
views
How do I send a set of file paths to cat and display their contents? [duplicate]
to be more specific ,I want to display contents of files from output of find command,I tried the following commands but they don't get my work done
cat < find . -name "*.txt"
find . -name "*.txt" | ...
1
vote
1
answer
3k
views
How do I touch every file in a directory? [duplicate]
I'm using Amazon Linux with bash shell. I'm trying to touch every file in a certain directory, but this command is failing:
[myuser@mymachine scripts]$ find /usr/java/jboss/standalone/deployments/...
0
votes
2
answers
175
views
Not found argument in -exec [duplicate]
I have such a problem, I'm trying to output a list of movies without the names of directories in the file, but I have a bug, the argument is not found in the -exeс, below is the code
$ find . -name "*...
1
vote
1
answer
150
views
delete all empty directories starting with [duplicate]
How to delete all empty directories starting with 201 ?
The command must not execute recursive.. Only directories in the current directory
find /var/www -type d -name "201*" -exec rm {} \
This ...
1
vote
1
answer
130
views
Executing shell script from command line [duplicate]
I have a perl script that converts a file to json format and writes the output to a separate directory. It accepts 2 parameters, filename and output directory. The script needs to be run on multiple ...
0
votes
0
answers
115
views
Use the output of find as the input for another command? [duplicate]
I am looking for a specific symbol in a bunch of shared libraries, I am using the following command:
find . -iname "*.so" | nm -D //loop over output of find | grep -e symbol
How can I tell nm -D to ...
220
votes
8
answers
45k
views
Why is looping over find's output bad practice?
This question is inspired by
Why is using a shell loop to process text considered bad practice ?
I see these constructs
for file in `find . -type f -name ...`; do smth with ${file}; done
and
for ...
196
votes
2
answers
210k
views
Understanding the -exec option of `find`
I find myself constantly looking up the syntax of
find . -name "FILENAME" -exec rm {} \;
mainly because I don't see how exactly the -exec part works. What is the meaning of the braces, the backslash ...
29
votes
7
answers
15k
views
Find files that are not in .gitignore
I have find command that display files in my project:
find . -type f -not -path './node_modules*' -a -not -path '*.git*' \
-a -not -path './coverage*' -a -not -path './bower_components*' \
...
18
votes
5
answers
9k
views
Run `grep` excluding a file in a specific path
I want to exclude the file ./test/main.cpp from my search.
Here's what I'm seeing:
$ grep -r pattern --exclude=./test/main.cpp
./test/main.cpp:pattern
./lib/main.cpp:pattern
./src/main.cpp:pattern
I ...
6
votes
2
answers
43k
views
How to find and run a bash script?
I have a script named script.sh. I don't know where it is in the file system, but I do know it exists.
How do I find the script, make it executable, and run it all in one line through the command ...
12
votes
1
answer
16k
views
What's the {} in find /path/ -exec command '{}' do?
I'm curious as to what the {} in the following command is actually for?
Example Command:
find /foo/ -name "*.txt" -exec rm -v {} \;
The Man page provided a small blurb but it confused me a little ...
4
votes
1
answer
5k
views
How to use regex inside exec with find?
Is it possible to use regular expressions based on the result (file name) inside the exec argument with find? I want to be able to "exec" based on parts of the argument, like:
find . -name pattern -...
0
votes
1
answer
706
views
Move files by its size
I have a little introductory exercise to do as homework, I have to do a little script which takes 2 arguments, first argument a directory the second argument a number.
The functionality is to ...