Terminal only shows > symbol when I enter this find command [duplicate]

Multi tool use
up vote
0
down vote
favorite
This question already has an answer here:
What mode does the terminal go into when I type a single quote?
2 answers
I want to delete all .ppm and .png files under current directory. So after checking some web pages about the usage of "find" command on the Internet, I typed the command below:
find . -type f ( -iname ".png" -o -iname ".ppm ) -exec rm {} ;
but the Terminal just showed a
>
and did not do anything. What was wrong with it?
16.04 command-line bash find
marked as duplicate by wjandrea, Sergiy Kolodyazhnyy, karel, Fabby, Zanna Nov 30 at 11:24
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
up vote
0
down vote
favorite
This question already has an answer here:
What mode does the terminal go into when I type a single quote?
2 answers
I want to delete all .ppm and .png files under current directory. So after checking some web pages about the usage of "find" command on the Internet, I typed the command below:
find . -type f ( -iname ".png" -o -iname ".ppm ) -exec rm {} ;
but the Terminal just showed a
>
and did not do anything. What was wrong with it?
16.04 command-line bash find
marked as duplicate by wjandrea, Sergiy Kolodyazhnyy, karel, Fabby, Zanna Nov 30 at 11:24
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Since you had an argument list too long issue, see also Renaming large number of image files with bash
– Zanna
Nov 30 at 11:24
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question already has an answer here:
What mode does the terminal go into when I type a single quote?
2 answers
I want to delete all .ppm and .png files under current directory. So after checking some web pages about the usage of "find" command on the Internet, I typed the command below:
find . -type f ( -iname ".png" -o -iname ".ppm ) -exec rm {} ;
but the Terminal just showed a
>
and did not do anything. What was wrong with it?
16.04 command-line bash find
This question already has an answer here:
What mode does the terminal go into when I type a single quote?
2 answers
I want to delete all .ppm and .png files under current directory. So after checking some web pages about the usage of "find" command on the Internet, I typed the command below:
find . -type f ( -iname ".png" -o -iname ".ppm ) -exec rm {} ;
but the Terminal just showed a
>
and did not do anything. What was wrong with it?
This question already has an answer here:
What mode does the terminal go into when I type a single quote?
2 answers
16.04 command-line bash find
16.04 command-line bash find
edited Nov 30 at 11:21


Zanna
49.3k13126236
49.3k13126236
asked Nov 29 at 23:52


gbcat
32
32
marked as duplicate by wjandrea, Sergiy Kolodyazhnyy, karel, Fabby, Zanna Nov 30 at 11:24
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by wjandrea, Sergiy Kolodyazhnyy, karel, Fabby, Zanna Nov 30 at 11:24
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Since you had an argument list too long issue, see also Renaming large number of image files with bash
– Zanna
Nov 30 at 11:24
add a comment |
Since you had an argument list too long issue, see also Renaming large number of image files with bash
– Zanna
Nov 30 at 11:24
Since you had an argument list too long issue, see also Renaming large number of image files with bash
– Zanna
Nov 30 at 11:24
Since you had an argument list too long issue, see also Renaming large number of image files with bash
– Zanna
Nov 30 at 11:24
add a comment |
2 Answers
2
active
oldest
votes
up vote
3
down vote
accepted
You just forgot to close the quoted string with a "
after ".ppm
.
The >
you see is Bash's secondary prompt, as defined by the $PS2
environment variable. You get it when you input a command fragment that is supposed to continue (like e.g. because it has an unclosed quoted string or a missing done
or fi
keyword...) but press Enter to make a line break.
Another thing is that -iname ".png"
would only (case insensitively) match files with the exact name ".png". What you want is to match all files ending with ".png", so the condition must be -iname "*.png"
instead. Same for ".ppm" of course.
So the correct find
command would be:
find . -type f ( -iname "*.png" -o -iname "*.ppm" ) -exec rm {} ;
However, I'd usually recommend dry-running it without the -exec rm {} ;
first and check the list of files again for correctness, before actually letting it delete stuff without further confirmation.
Also, as correctly pointed out in the comments, you can and probably should replace -exec rm {} ;
with -delete
to let find
handle the deletion internally.
Thank you very much.
– gbcat
Nov 30 at 0:12
1
Note that you can use-delete
instead of-exec rm {} ;
, which is just cleaner
– wjandrea
Nov 30 at 0:25
add a comment |
up vote
0
down vote
You don't need find
for this. Instead, you can run
rm *{.png,.ppm}
in the directory.
1
Sorry, I have tried it yet, but Argument list too long.
– gbcat
Nov 30 at 0:05
Have you copied and pasted it? I tested it and worked.
– Turtle10000
Nov 30 at 0:08
1
Of course it will work with a few images. But my directory contains more than 100,000 images.
– gbcat
Nov 30 at 0:10
Sorry then, didn't understand your first comment right.
– Turtle10000
Nov 30 at 0:11
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
You just forgot to close the quoted string with a "
after ".ppm
.
The >
you see is Bash's secondary prompt, as defined by the $PS2
environment variable. You get it when you input a command fragment that is supposed to continue (like e.g. because it has an unclosed quoted string or a missing done
or fi
keyword...) but press Enter to make a line break.
Another thing is that -iname ".png"
would only (case insensitively) match files with the exact name ".png". What you want is to match all files ending with ".png", so the condition must be -iname "*.png"
instead. Same for ".ppm" of course.
So the correct find
command would be:
find . -type f ( -iname "*.png" -o -iname "*.ppm" ) -exec rm {} ;
However, I'd usually recommend dry-running it without the -exec rm {} ;
first and check the list of files again for correctness, before actually letting it delete stuff without further confirmation.
Also, as correctly pointed out in the comments, you can and probably should replace -exec rm {} ;
with -delete
to let find
handle the deletion internally.
Thank you very much.
– gbcat
Nov 30 at 0:12
1
Note that you can use-delete
instead of-exec rm {} ;
, which is just cleaner
– wjandrea
Nov 30 at 0:25
add a comment |
up vote
3
down vote
accepted
You just forgot to close the quoted string with a "
after ".ppm
.
The >
you see is Bash's secondary prompt, as defined by the $PS2
environment variable. You get it when you input a command fragment that is supposed to continue (like e.g. because it has an unclosed quoted string or a missing done
or fi
keyword...) but press Enter to make a line break.
Another thing is that -iname ".png"
would only (case insensitively) match files with the exact name ".png". What you want is to match all files ending with ".png", so the condition must be -iname "*.png"
instead. Same for ".ppm" of course.
So the correct find
command would be:
find . -type f ( -iname "*.png" -o -iname "*.ppm" ) -exec rm {} ;
However, I'd usually recommend dry-running it without the -exec rm {} ;
first and check the list of files again for correctness, before actually letting it delete stuff without further confirmation.
Also, as correctly pointed out in the comments, you can and probably should replace -exec rm {} ;
with -delete
to let find
handle the deletion internally.
Thank you very much.
– gbcat
Nov 30 at 0:12
1
Note that you can use-delete
instead of-exec rm {} ;
, which is just cleaner
– wjandrea
Nov 30 at 0:25
add a comment |
up vote
3
down vote
accepted
up vote
3
down vote
accepted
You just forgot to close the quoted string with a "
after ".ppm
.
The >
you see is Bash's secondary prompt, as defined by the $PS2
environment variable. You get it when you input a command fragment that is supposed to continue (like e.g. because it has an unclosed quoted string or a missing done
or fi
keyword...) but press Enter to make a line break.
Another thing is that -iname ".png"
would only (case insensitively) match files with the exact name ".png". What you want is to match all files ending with ".png", so the condition must be -iname "*.png"
instead. Same for ".ppm" of course.
So the correct find
command would be:
find . -type f ( -iname "*.png" -o -iname "*.ppm" ) -exec rm {} ;
However, I'd usually recommend dry-running it without the -exec rm {} ;
first and check the list of files again for correctness, before actually letting it delete stuff without further confirmation.
Also, as correctly pointed out in the comments, you can and probably should replace -exec rm {} ;
with -delete
to let find
handle the deletion internally.
You just forgot to close the quoted string with a "
after ".ppm
.
The >
you see is Bash's secondary prompt, as defined by the $PS2
environment variable. You get it when you input a command fragment that is supposed to continue (like e.g. because it has an unclosed quoted string or a missing done
or fi
keyword...) but press Enter to make a line break.
Another thing is that -iname ".png"
would only (case insensitively) match files with the exact name ".png". What you want is to match all files ending with ".png", so the condition must be -iname "*.png"
instead. Same for ".ppm" of course.
So the correct find
command would be:
find . -type f ( -iname "*.png" -o -iname "*.ppm" ) -exec rm {} ;
However, I'd usually recommend dry-running it without the -exec rm {} ;
first and check the list of files again for correctness, before actually letting it delete stuff without further confirmation.
Also, as correctly pointed out in the comments, you can and probably should replace -exec rm {} ;
with -delete
to let find
handle the deletion internally.
edited Nov 30 at 0:47
answered Nov 30 at 0:11


Byte Commander
62.5k26169283
62.5k26169283
Thank you very much.
– gbcat
Nov 30 at 0:12
1
Note that you can use-delete
instead of-exec rm {} ;
, which is just cleaner
– wjandrea
Nov 30 at 0:25
add a comment |
Thank you very much.
– gbcat
Nov 30 at 0:12
1
Note that you can use-delete
instead of-exec rm {} ;
, which is just cleaner
– wjandrea
Nov 30 at 0:25
Thank you very much.
– gbcat
Nov 30 at 0:12
Thank you very much.
– gbcat
Nov 30 at 0:12
1
1
Note that you can use
-delete
instead of -exec rm {} ;
, which is just cleaner– wjandrea
Nov 30 at 0:25
Note that you can use
-delete
instead of -exec rm {} ;
, which is just cleaner– wjandrea
Nov 30 at 0:25
add a comment |
up vote
0
down vote
You don't need find
for this. Instead, you can run
rm *{.png,.ppm}
in the directory.
1
Sorry, I have tried it yet, but Argument list too long.
– gbcat
Nov 30 at 0:05
Have you copied and pasted it? I tested it and worked.
– Turtle10000
Nov 30 at 0:08
1
Of course it will work with a few images. But my directory contains more than 100,000 images.
– gbcat
Nov 30 at 0:10
Sorry then, didn't understand your first comment right.
– Turtle10000
Nov 30 at 0:11
add a comment |
up vote
0
down vote
You don't need find
for this. Instead, you can run
rm *{.png,.ppm}
in the directory.
1
Sorry, I have tried it yet, but Argument list too long.
– gbcat
Nov 30 at 0:05
Have you copied and pasted it? I tested it and worked.
– Turtle10000
Nov 30 at 0:08
1
Of course it will work with a few images. But my directory contains more than 100,000 images.
– gbcat
Nov 30 at 0:10
Sorry then, didn't understand your first comment right.
– Turtle10000
Nov 30 at 0:11
add a comment |
up vote
0
down vote
up vote
0
down vote
You don't need find
for this. Instead, you can run
rm *{.png,.ppm}
in the directory.
You don't need find
for this. Instead, you can run
rm *{.png,.ppm}
in the directory.
answered Nov 30 at 0:03
Turtle10000
1065
1065
1
Sorry, I have tried it yet, but Argument list too long.
– gbcat
Nov 30 at 0:05
Have you copied and pasted it? I tested it and worked.
– Turtle10000
Nov 30 at 0:08
1
Of course it will work with a few images. But my directory contains more than 100,000 images.
– gbcat
Nov 30 at 0:10
Sorry then, didn't understand your first comment right.
– Turtle10000
Nov 30 at 0:11
add a comment |
1
Sorry, I have tried it yet, but Argument list too long.
– gbcat
Nov 30 at 0:05
Have you copied and pasted it? I tested it and worked.
– Turtle10000
Nov 30 at 0:08
1
Of course it will work with a few images. But my directory contains more than 100,000 images.
– gbcat
Nov 30 at 0:10
Sorry then, didn't understand your first comment right.
– Turtle10000
Nov 30 at 0:11
1
1
Sorry, I have tried it yet, but Argument list too long.
– gbcat
Nov 30 at 0:05
Sorry, I have tried it yet, but Argument list too long.
– gbcat
Nov 30 at 0:05
Have you copied and pasted it? I tested it and worked.
– Turtle10000
Nov 30 at 0:08
Have you copied and pasted it? I tested it and worked.
– Turtle10000
Nov 30 at 0:08
1
1
Of course it will work with a few images. But my directory contains more than 100,000 images.
– gbcat
Nov 30 at 0:10
Of course it will work with a few images. But my directory contains more than 100,000 images.
– gbcat
Nov 30 at 0:10
Sorry then, didn't understand your first comment right.
– Turtle10000
Nov 30 at 0:11
Sorry then, didn't understand your first comment right.
– Turtle10000
Nov 30 at 0:11
add a comment |
telH k aqa6X,fahs 1FeM9Z,Ps w3umycGvFnW7 LLgXI 3SjCiDdNnO3L4nZyA6T
Since you had an argument list too long issue, see also Renaming large number of image files with bash
– Zanna
Nov 30 at 11:24