All Questions
17
questions
4
votes
3
answers
1k
views
find -exec command options with basename [duplicate]
I have the following JPEG files :
$ ls -l
-rw-r--r-- 1 user group 384065 janv. 21 12:10 CamScanner 01-10-2022 14.54.jpg
-rw-r--r-- 1 user group 200892 janv. 10 14:55 CamScanner 01-10-2022 14.55.jpg
-...
2
votes
4
answers
1k
views
When are grouped parentheses for multiple options necessary?
I am using the find and grep commands.
Getting quite confused about when multiple options are joined by "or"
with the -o flag and the use of grouped parentheses, and when grouped parentheses ...
0
votes
1
answer
145
views
What are really the prefix rules for options: - and -- ? Why is the find command not compatible with the --name option? [duplicate]
Once, I've learned that options of Linux commands came in two manners:
those of one letter, prefixed by a -
those of many letters, prefixed by a --
And this works in 95% of the cases.
But not, for ...
1
vote
2
answers
259
views
Aliasing grep in find's -exec option
I have these aliases in my ~/.bashrc
alias grep='grep --color=auto -H'
alias fgrep='fgrep --color=auto -H'
alias egrep='egrep --color=auto -H'
but they have no effect when I run find ... -exec grep .....
3
votes
1
answer
2k
views
Can the Linux find -iname option take more the one pattern
Using the Linux find command -iname option, I want to find and move files that have many different extensions (.pdf, .doc, .xlx, .ppt). I know I can use multiple patterns with grep. But can that ...
0
votes
1
answer
1k
views
find option as command line argument
I have got a problem with my script. I am trying to write a script, where option for command find is the first command line argument.
In my script I've got something like
find_option=$1
find $...
0
votes
2
answers
627
views
Understand -exec command? [duplicate]
This works
find ./ -iname '*.c' -o -name '*.h' -o -name '*.l' -exec grep -irn test1 {} \;
If I combine -exec with ls then it tells me that is improper option.
#ls -exec touch {} \;
ls: invalid ...
1
vote
2
answers
83
views
Discard "access denied" stderr natively in find
Is there an option in find that allows me to suppress the error messages that I get from it trying to access directories for which I don't have access?
I know I can just discard stderr, but it seems ...
0
votes
1
answer
1k
views
find command - how to ignore case in -path option?
when searching filename or dirname case-insensetively, we can use option -iname.
but if I want to ignore case in -path option, what should I do?
can I do it with only find command, without using ...
4
votes
1
answer
1k
views
Why should I escape the semicolon with find?
I'm using bash on Debian. I have to write
find -iname "*mp3" -exec cp {} /media/MP3Player/ \;
escaping the final semicolon, or else I get an error.
-1
votes
1
answer
62
views
Why does adding -prune to my sync script cause rsync to do a DRY-RUN?
I'm testing a script to do a by-directional sync of two directories intelligently using rsync.
Since I'm testing many of the rsync options are not applicable to the testing environment including the ...
0
votes
2
answers
298
views
Are `-name` and `-exec` options or non-option arguments of `find`?
Are -name and -exec options or non-option arguments of find? They look like short options, and they are called find expressions, if I am not mistaken. For example,
find . -name "*.txt" -exec echo {} ...
2
votes
1
answer
4k
views
Parameters of find command
What difference does it make when using the -print and -depth parameters in find command, given that they produce the same outcome:
/home/pkaramol/Desktop/testdir
$ find .
.
./testfile3.txt
./...
3
votes
1
answer
847
views
Meaning of the double dash in options [closed]
I've read that all multi-character command options must be preceded by a double dash (--). But many flags for the find command (e.g. -name or -type) are preceded by only one dash. Why is that?
1
vote
4
answers
131
views
Why is it find dir -name file and not find -n dir file?
I've searched around for this but I couldn't find anything on it.
I've always wanted to know, why is it that most other built in bash commands have the format of command -flag arg1 arg2, i.e. cp -r ...