All Questions
13 questions
0
votes
1
answer
1k
views
Creating an alias for the find command in Linux
I have created the following alias in my .bashrc file:
alias find='find . -type f -name'
This obviates the need to type . -type f -name every time I do a file search. However, I still have to enclose ...
2
votes
2
answers
273
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 .....
-1
votes
2
answers
405
views
alias the find function and use it with sudo [duplicate]
I'm having trouble creating an alias so I can run find in "silent mode" (without all the Permission denied messages). my bash skills are pretty bad so I'm not sure how to fix this
here's my alias in ~...
3
votes
2
answers
312
views
find - how do i make an alias to do something like (find . -iname '*$1*')?
I have a findn function:
findn () {
find . -iname "*$1*"
}
Using this function has one downside that I cannot use -print0 | xargs -0 command (I am using mac) following findn filename to extend ...
1
vote
2
answers
1k
views
find exec does not work with command aliases?
I'm trying to do a find with a -exec of a command aliased in my .bash_profile on macOS. The find command shows
find: [alias cmd]: No such file or directory
when I use
find ./ -iname *.doc -exec ...
1
vote
2
answers
289
views
How do I update this recursive directory file search for input and name outputs to handle the below case
I am updating a script that recursively goes through a directory and ocrs the pdf and updates the pdf.
In its simple version, it works.
ocrmypdf -l vie --deskew --clean --force-ocr --sidecar ...
0
votes
1
answer
160
views
How can I improve below alias?
I want to run less -F command on latest updated log file of one binary (which creates logs with names which start with xtest*) which is in logs directory.
I was able to create below alias in csh, but ...
0
votes
1
answer
320
views
Always exclude path in find command
I have a directory whose contents should never be found by find, so I aliased find like this:
alias find='find -not -path "*.sync*"'
the issue is that find now complains that operators are not ...
3
votes
1
answer
3k
views
Odd alias "find . -name '*\!{*}*' -ls" in Unix Power Tools
From Unix Power Tools 3rd Edition page 175:
Article 9.27 shows a way to match directories in the middle of a path. Here's a simpler "find file" alias that can come in very handy:
alias ff &...
3
votes
2
answers
451
views
How to alias part of expression for find?
I prefer regular expressions with -regex over the shell pattern syntax of -name. I also want to use the posix-egrep type, so I'd like to do something like
alias find="find -regextype posix-egrep"
...
1
vote
2
answers
656
views
find command throws errors when inside function
I can run the following command in bash without any errors:
$ find /d/Code/Web/Development/Source/ \( -name '*.cs' -o -name '*.cshtml' \) -exec grep -IH UserProfileModel {} \;
I wrote a function in ....
3
votes
1
answer
903
views
Error creating an alias for the find command [duplicate]
Possible Duplicate:
How to pass parameter to alias?
I am trying to shorten the find command, but getting an error:
$ alias f='find . -name $1 -print'
$ f JobConf.java
find: paths must precede ...
1
vote
3
answers
2k
views
A problem with find and grep
I have defined the following alias in ~/.bashrc:
alias fg='find . -name $1 | xargs grep --color $2'
in order to write
fg "*.txt" " my_text "
and find all file that have extension .txt and ...